loading...
Cover image for Git cheat sheet

Git cheat sheet

chrissiemhrk profile image Chrissie Updated on ・2 min read

I made this cheat sheet for git terminologies and most common commands when I was going through a Udacity course about version control. It helped me a lot and though it will be great to share it with others.

Repository this is a directory where your project/files are stored which are used to interact with Git.

commit this is when you make one or more changes to a file in git.

branch this is creating a new line of development. This is mainly used to continue working without messing with the mainline of development.

git commit this is the command used to commit changes to your git repo. Commit contains a message which is used to describe what changes you've made.

staging area this is where git will put/store files while waiting for you to commit the file containing the changes.

SHA this is a unique ID number that is given to each of your commits.

git init this command is used to initialize your project into a repository.

git clone this command is used to copy an existing repository to your computer.

git checkout this command takes you to a different branch in your repo.

git branch this command is used to create a new branch.

git checkout -b this command is used to create a new branch and automatically switch to it.

git status this command shows you the current status of your repo like files which are yet to be committed or the branch you are currently in.

git push this command sends all your commits to the Github/Gitlab/Bitbucket repo you have created.

git pull this command fetch all your files from your repo and integrate them with your local repo. I mostly use it to make sure everything is up to date and working correctly.

git add this command is used to add files from the working directory to the staging area.

git diff this command is used to display the differences between two versions of a file also you can see changes that are yet to be committed using this command.

git merge this command is used to combine changes from different branches together.

git revert this command is used to a specific commit. It is usually followed by the commit SHA to indicate which commit you want to reverse.

Posted on by:

chrissiemhrk profile

Chrissie

@chrissiemhrk

Front-end web developer - HTML/CSS, JavaScript, Reactjs

Discussion

markdown guide
 

I always use these commands every weekday :).

And thanks for your organizing Git command lists!

 
 
Sloan, the sloth mascot Comment marked as low quality/non-constructive by the community View code of conduct

You could just paste in a man page. It would be more useful.