Skip to content

Instantly share code, notes, and snippets.

@thomashartm
Last active March 24, 2020 09:07
Show Gist options
  • Save thomashartm/062c1a501f3d1ee93d10c94bf6f52bfb to your computer and use it in GitHub Desktop.
Save thomashartm/062c1a501f3d1ee93d10c94bf6f52bfb to your computer and use it in GitHub Desktop.
Git commonly used commands cheatsheet
########################
# fetches all branches and commits from remote in this case origin
git fetch origin
########################
# show local branches
git branch
# shows alsp remote branches
git branch -r
########################
# Checkout local branch
git checkout develop
# Checkout and track a remote branch from origin in this case develop
git checkout --track origin/develop
# create new branch
git checkout -b branchname develop
# Removing a branch
git branch -D branchname
########################
# merge a branch named feature/myfeaturebranch into develop
git checkout develop
git merge --no-ff -m "Merged feature/myfeaturebranch into develop" feature/myfeaturebranch
########################
# push all changes and all tags
git push --all && git push --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment