Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

git-cheatsheet

branch

  • rename branch: git branch -m
  • set local branch to track remote branch: git branch --set-upstream develop origin/develop

remotes

  • see remote origin: git remote -v
  • change remote origin url: git remote set-url origin <url>
  • remove remote: git remote rm <name_of_remote_to_remove>

tags

  • see tags: git tag -l
  • checkout tag: git checkout tags/<tag_name>

stash

git stash
git branch <branch_name>
git checkout <branch_name>
git stash apply

stash naming

git stash save "abc"
git stash apply stash^{/abc}

commit in wrong branch

git reset --soft HEAD^
git stash
git co
git stash apply

aliases

  • undo commit: git config --global alias.undo-commit 'reset --soft HEAD^'
  • unpushed commits: git config --global alias.unpushed "log --branches --not --remotes --simplify-by-decoration --decorate --oneline"
  • checkout: git config --global alias.co "checkout"
  • list branches: git config --global alias.ba "branch -a"
  • last commit: git config --global alias.last=log -1 HEAD --stat

Or just the git plugin by Oh My Zsh.

About

:octocat: git-cheatsheet

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors