- Atlassian Git Tutorial
- git-cheat-sheet
- Learn Enough Git to Be Dangerous
- Git Workflows for Pros: A Good Git Guide
- Git from the inside out
- git-game
- Introduction to Git - talk by Scott Chacon
- Git Tutorial β Git Fu With The Command Line
- Git Immersion
- gitflow Git extensions to provide high-level repository operations for Vincent Driessen's branching model
- diff-so-fancy Good-lookin' diffs with diff-highlight and more
- twitter-for-github Twitter handles for GitHub
- octotree Code tree for GitHub and GitLab
- isometric-contributions Render an isometric pixel art version of your contribution graph in Chrome and Safari.
- github-s3 Shell scripts that make it really easy to archive and restore repositories between GitHub and AWS S3
git tag
git tag -a v1.4 -m "my version 1.4"
git push --delete origin tagname
git push origin :tagname
git push origin tagname
git tag new old
git tag -d old
git push origin :refs/tags/old
git push --tags
git push origin :refs/tags/<tagname>
git tag -fa tagname
git push origin master --tags
git remote
git remote rename old new
git branch
Create the branch on your local machine and switch in this branch
git checkout -b branch_name
git branch branch_name sha1_of_commit
git push origin branch_name
Rename other branch
git branch -m old new
Rename current branch
git branch -m new
git branch -m old new # Rename branch locally
git push origin :old # Delete the old branch
git push --set-upstream origin new # Push the new branch, set local branch to track the new remote
git branch -D the_local_branch
git push origin :the_remote_branch
git reset --hard HEAD~1
git rebase -i HEAD~5
git reset --soft HEAD~5
git add .
git commit -m "Update"
git push -f origin master
git branch newbranch
git reset --hard HEAD~3 # Go back 3 commits. You *will* lose uncommitted work.*1
git checkout newbranch
git cherry-pick hash_commit_A hash_commit_B
git reflog
git reset --hard 0254ea7
git cherry-pick 12944d8
git revert --no-commit 0766c053..HEAD
git commit
git commit --amend
git commit --amend --no-edit
git commit --amend -m "New commit message"
git commit --amend -m "New commit message"
git push --force <repository> <branch>
git checkout tagname
git checkout -b newbranchname tagname
git checkout destination_branch
Use -m if there is merge conflict
git checkout -m master // from feature branch to master
git checkout commit_hash
git checkout -b newbranchname HEAD~4
git checkout -b newbranchname commit_hash
git checkout commit_hash file
git stash save "stash name"
git stash
git stash list
git stash pop
git stash apply
git stash apply stash@{2}
git rebase base // rebase the current branch onto base
git rm -r --cached .
git add .
git commit -am "Remove ignored files"
git clean
git reset file
git reset
git reset --hard
git checkout --ours foo/bar.java
git add foo/bar.java
git pull -X theirs
git checkout --theirs path/to/the/conflicted_file.php
git checkout --theirs .
git add .
git checkout branchA
git merge -X theirs branchB
git checkout feature1
git merge --no-ff master