Skip to content

Instantly share code, notes, and snippets.

@simone-sanfratello
Last active June 18, 2020 05:10
Show Gist options
  • Save simone-sanfratello/8f2bc8ecec2affe57e616e365a2f2482 to your computer and use it in GitHub Desktop.
Save simone-sanfratello/8f2bc8ecec2affe57e616e365a2f2482 to your computer and use it in GitHub Desktop.
git quick

add a remote

git remote add remoteName https://github.com/user/repo.git

pull another branch into current

git pull origin otherBranch:otherBranch

squash current branch

3 is the number of commit to squash

git reset --soft HEAD~3

squash merge

git checkout yourBranch
git reset $(git merge-base targetBranch yourBranch)
git add -A
git commit -m "one commit on yourBranch"
git checkout targetBranch
git merge yourBranch

delete remote branch

git push origin --delete yourBranch

remove history on current branch

git reset $(git commit-tree HEAD^{tree} -m "A new start")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment