git cheatsheet
# git init
# git init Initialized empty Git repository in /Users/rupert/projects |
# git status
# git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: file2 # |
# git commit
# git commit -m "Added support on something" spec/requests/status_spec.rb [master 7651ed1] typo on route 1 files changed, 2 insertions(+), 2 deletions(-) |
# git push
# git push => defaults to git push origin master # git push origin master # git push origin branch_name => pushes branch_name to remote # git push origin --delete branch_name => deletes branch_name in remote # git push --tags => pushes tags to remote |
# git pull
# git pull # git pull . branch_name |
# git branch
# git branch -a => lists all branches in local and remote experimental * master remotes/origin/HEAD -> origin/master remotes/origin/experimental remotes/origin/master # git branch new_branch => creates new_branch locally # git branch -D new_branch => deletes the new_branch locally. To delete remotely see git push |
# git checkout or git co
# git checkout experimental Switched to branch 'experimental' |