Git Commands and What They Are Used For
Git Commands and What They Are Used For
I have been using git for a long time, but I was always doing this through the GitHub interface. Recently, I started doing it a bit more via the terminal because you can synchronize your project with git systems much faster this way compared to the interface.
With this being the case, I started writing articles about git on my website, and if I remember correctly, I decided to make this the 4th or 5th article about Git commands.
Let's take a look together at which commands we need to use when using Git on the terminal and what these commands are used for.
Git Commands
The visual below will actually help you in English about many commands, but let's briefly explain the commands under the visual in case we need to write their Turkish equivalents as well.
Git Init Command
git init
When we access the project's folder via the terminal and use this command, the "git init" command integrates git into our project and creates the necessary git folders. A folder named ".git" is created and everything related to git (almost everything) is kept inside this folder.
The following files are located inside the .git folder.
- HEAD
- branches
- config
- description
- hooks
- index
- logs
- objects
- packed-refs
- refs
Additionally, after the git Init command, you can create a .gitignore file for the files you do not want to be included in git in your project.
Git Status
git status
This command allows you to see the changes that have not been committed to the system.
Git Add
git add
This command allows us to add the files we want to send to the staging area before sending them to the git system.
Let's look at the visual below to understand this part better.
The important parts for us here are the red and yellow areas.
The red area represents our working directory, and our actual project is here.
The yellow area represents the backup we take before saving it to the git system.
git reset HEAD <filename>After this process, the file we added to the staging area will be removed from the staging area.
Git Commit
git commit -m ‘msg’
With the above command, we save our project files from the staging area to our local system.
Git Push
git push origin master
With this command, we can send the changes we made in our project to the remote server and share them with other project collaborators.
Git Pull
git pull
With the pull command, we check the project and can see the updates made by others.
Git Logs
git logs
With the logs command, we can see the history of the changes made in the project and who made them.
Git Show
git shows
This command can be used to see the changes made in the commit.
Git Branch
git branch
This is the command we use to create a branch.



Yorum Gönder