Git is surprisingly easy to learn. It had only taken me about an hour to understand the concept and almost 90% of the command that will be used in the real-world environment. I wish I could’ve spent this one hour to sit down and learn it seriously before get to work with others.

I find this project called learn git branching extremely useful, and below is the cheatsheet I made after studying the whole project

Editting

git branch <newBranch>
newBranch
git commit
This command will create a new commit on top of the current commit.
commit

git reset
This command will remove all the changes and bring you back to the parent commit.
reset

Moving

git checkout <branch>
This command will bring you to the commit where the branch pointer pointing at or the commit with the denoted hash.
checkout

git checkout <commit hash>
This command will move the HEAD pointer to the denoted commit.
checkout hash

git checkout HEAD^
This command will move the HEAD to the parent of the current commit.
checkout HEAD

git checkout HEAD~<level>
This command will move the HEAD pointer upward for levels.

Editing

git rebase <branch>
This command will perform two tasks. First, make a copy of the current branch, then paste it on top of the denoted branch.
rebase

git merge <branch>
This command will merge the current branch with the denoted branch.
merge

git revert <commit hash> | <branch>
This command will create a new commit, and this new commit is a copy of the commit denoted or the commit that a branch pointed to.

Copying

git cherry-pick <commit hashes>
This command will make a copy of the selected commits and put it on top of the current branch.

cherry-pick

git rebase -i <commit hash>
A file will pop up, and upon changing the file, you’ll change the structure as you denoted in the file. This is a little trickier than cherry-pick, but it is just a different approach that accomplishes the same tasks. I’ll have another post talking about this command in detail.