Git Commands
Git Commands |
Description |
git help |
Show help information about git commands |
git init |
Init new git project in current folder (folder needs to be empty) |
git clone git@github.com:myusername/myrepositoryname.git |
Clone a git repository from github.com |
git add . |
Stage all files |
git commit -m "my message" |
Create a commit of your stages files |
git pull |
Pull updates from remote to current branch |
git push |
Push your commits to remote repository |
git push --tags |
Push your commits + tags |
git status |
Show status of unstaged files, project info, branch info, ... |
git branch |
Show all git branches (option -a for showing remotes too) |
git branch mynewbranch |
Create a new branch |
git checkout myotherbranch |
Switch to another git branch |
git log |
Show latest git commits and messages (or "git show") |
git fetch --all |
Fetch from all remote repositories |
git tag 0.1.0 |
Tag current as "0.1.0" |
git tag --delete 0.1.0 |
Remove Tag "0.1.0" |
git revert commitHash | Revert changes of a specific commit |
Git Commands (Advanced) |
Description |
git stash --include-untracked |
Save all changes to the stash |
git stash push -m "stashname" |
Save all changes to the stash with a name |
git stash list |
Show all saved stashes |
git stashpop 0 |
Apply the latest stash + remove it from the stash list |
git stash apply 0 |
Apply the latest stash |
git stash drop 0 |
Remove latest stash from stash list |
git blame pathtomyfile.txt |
Show information who to blame for a file change |
git diff |
Show changes between two commits |
git grep "text-to-search" |
Search for a specific string in commits |
git format-patch -1 <commitID> | Create a patch of a specific commit |
git apply <patchfile> | Apply a patch |
git bisect start | Start Bugfinding / Begin using the git bisect command |
git bisect good |
Identify if a commit is "good", without the bug |
git bisect bad |
Identify if a commit is "bad", with the bug |
git bisect reset | Return to original head |
git bisect log | Displays commits you've identified as "good" or "bad" |
git bisect visualize | View commits that have not yet been checked |