Skip to content

Instantly share code, notes, and snippets.

@krfong916
Last active January 12, 2020 12:09
Show Gist options
  • Save krfong916/1464fba0bdb00658ea545ed5602697aa to your computer and use it in GitHub Desktop.
Save krfong916/1464fba0bdb00658ea545ed5602697aa to your computer and use it in GitHub Desktop.
Git commands

Change remote url

git remote set-url origin new.git.url/here

Migrating code to new repo

  • Create github repo
  • git remote set-url origin new.git.url/here
  • git init in repo to migrate
  • Prune/Cleanup the local references to remote branch
    • show branches to prune: git remote prune origin --dry-run
    • prune all branches: git remote prune origin
  • Push to master git push -u origin/master

Create a new "subbranch"

git checkout -b branchname_here

View remote branches

git remove -v

Delete a local branch

To delete the local branch use one of the following:

git branch -d branch_name git branch -D branch_name

Delete a remote branch

git push -d origin <branch_name>

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment