Git Cheat Sheet Volume 1 Create From existing data
Revert Revert the last commit
cd ˜/my_project_dir $ git init $ git add .
Resolve merge conflicts View merge conflicts
$ git revert HEAD
$ git diff
Return to last committed state $ git checkout -f | git reset –hard
View merge conflicts against base file $ git diff –base
From existing repo $ git clone ˜/existing/repo ˜/new/repo $ git clone
[email protected]:dir/project.git $ git clone http://[USER@]host.de/project.git
Browse
Revert specific commit
View merge conflicts against other changes $ git diff −−theirs
$ git revert fix/change last commit
View merge conflicts against your changes
$ git commit −−amend
$ git diff −−ours
Files changed in working directory $ git status
branch List all branches (locally and remote)
Changes of tracked files
After resolving conflicts, merge with $ git add $ git rebase −−continue
$ git branch -a
$ git diff Changes between ID1 and ID2
Publish
Switch to BRANCH $ git checkout BRANCH
$ git diff
Push changes to origin $ git push [origin] [branch]
Merge Branch B1 into B2
History of changes $ git log
Commit Commit all local changes
$ git checkout $ git merge $ git merge –no-ff -m „Message“ generates commit even as –ff option $ git merge –squash merge without generated commit
Make a Version $ git tag Prepare a patch $ git format-patch origin
$ git commit -a Create Branch based on HEAD
Configuration
$ git branch Commit all local changes and add message $ git commit -am „“ Create Branch based on HEAD and checkout
Useful tips Documentation/help $ git help [command] $ man git-[command]
$ git checkout -b user Create Branch based on another $ git branch
user.name NAME user.email EMAIL color
Delete a branch Push branch to remote
$ git config [−−global] [option] global is stored in ˜/.gitconfig
color.ui auto
$ git branch -d
$ git push
Update Delete branch (locally and remote) $ git branch -d $ git push : Change not pushed commits untill ID $ git rebase -i
Fetch latest changes from origin
optimisation packs.threads 0 diff.renamelimit 0
$ git fetch see if something changed $ git remote update
Date: February 20, 2013 - Version 1.5 Author: Max Oberberger (
[email protected]) https://github.com/chiemseesurfer/latex-gitCheatSheet