Git Commands
| Git Commands |
Description |
| 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 |
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 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
git fetch --all
Fetch from all remote repositories
| 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 |