Skip to content

Instantly share code, notes, and snippets.

@rodkranz
Last active August 29, 2017 10:08
Show Gist options
  • Save rodkranz/7d7abcac789b91c773e0e27fa7d35f9c to your computer and use it in GitHub Desktop.
Save rodkranz/7d7abcac789b91c773e0e27fa7d35f9c to your computer and use it in GitHub Desktop.
Github helpers

Rename your local branch.

If you are on the branch you want to rename:

$ git branch -m new-name

If you are on a different branch:

$ git branch -m old-name new-name

Delete the old-name remote branch and push the new-name local branch.

$ git push origin :old-name new-name

Reset the upstream branch for the new-name local branch, switch to the branch and then:

$ git push origin -u new-name

Rollback lates commit

$ git reset --soft HEAD~

Config go get to work with private repository.

$ git config --global http.extraheader "PRIVATE-TOKEN: YOUR_PRIVATE_TOKEN"
$ git config --global url."git@gitlab.mycompany.com:".insteadOf "https://gitlab.mycompany.com/"
$ go get gitlab.com/company/private_repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment