git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
git config --global core.editor emacs
git config --global color.ui true
git add --all
git stash
git stash save "message"
git stash list
git stash pop
git stash apply stash@{6}
git commit -m "Your commit message"
git commit --amend
git commit --date="date --date='2 day ago'
"
git commit --date="Jun 13 18:30:25 IST 2015"
git filter-branch --env-filter \
'if [ $GIT_COMMIT = 119f9ecf58069b265ab22f1f97d2b648faf932e0 ]
then
export GIT_AUTHOR_DATE="Fri Jan 2 21:38:53 2009 -0800"
export GIT_COMMITTER_DATE="Sat May 19 01:01:01 2007 -0700"
fi'
git reset --hard
git reset --hard HEAD~2
git clean -f -d
git clean -f -d -x
git push origin master
git push git@github.com:username/project.git
git branch -D branch_name
git branch -u upstream/foo
git blame filename
git remote add upstream git@github.com:name/repo.git # Set a new repo
git remote -v # Confirm new remote repo
git fetch upstream # Get branches
git branch -va # List local - remote branches
git checkout master # Checkout local master branch
git checkout -b new_branch # Create and checkout a new branch
git merge upstream/master # Merge remote into local repo
git show 83fb499 # Show what a commit did.
git show 83fb499:path/fo/file.ext # Shows the file as it appeared at 83fb499.
git diff branch_1 branch_2 # Check difference between branches
git log # Show all the commits
git status # Show the changes from last commit
git log --pretty=email --patch-with-stat --reverse --full-index -- Admin*.py > Sripts.patch
git --git-dir=../some_other_repo/.git format-patch -k -1 --stdout | git am -3 -k
git log @{u}..
git log -p feature --not master
git diff master...feature
git rebase -i @~7
git diff --no-index path/to/file/A path/to/file/B
git fetch --all
git reset --hard origin/master
git submodule update --init --recursive
git clone --depth 1
git pull --unshallow
git checkout --orphan branch_name
git checkout -b master upstream/master
git remote prune origin
git remote prune $(git remote | tr '\n' ' ')
git show :/cool
git checkout -p HEAD^ -- /path/to/file
git revert
git cherry-pick
git reset --hard HEAD~1
git reset HEAD~1
git diff-tree --no-commit-id --name-only -r ${commit_id}
git show --pretty="" --name-only bd61ad98