Skip to content

Instantly share code, notes, and snippets.

@daniel-williams
Last active November 26, 2016 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daniel-williams/b9ec09e4d7e07981fcb47e792079f0ee to your computer and use it in GitHub Desktop.
Save daniel-williams/b9ec09e4d7e07981fcb47e792079f0ee to your computer and use it in GitHub Desktop.
Gokking the Git
# deletes the local remote-tracking branch, but not the actual remote branch
git branch -rd origin/[branch name]
# To delete the actual remote branch
git push origin --delete [branch name]
# had a need to merge existing repo into a newly created repo without loosing history or either
# given repo A (new repo), and repo B (existing repo)
git clone A
git clone B
cd A
git remote add B ../B
git fetch --all
git merge --allow-unrelated-histories B/master
# will overwrite any existing master branch
git push -f origin master
# push local branch to remote with tracking
git push -u origin [branch name]
# for existing branch
git branch -u [origin]/[branch name]
git merge --squash [branch name]
git commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment