Ahmad 'Abe' Baehaki

Full-stack .NET Developer

github twitter linkedin email
My Notes: Git
2017-06-13
One minute read

Adding Remote Git

  • git remote add origin https://github.com/user/repo.git to add remote with origin as the name and https://github.com/user/repo.git as the URL.

Deleting Local Branch

  • git branch –D branchname to delete branchname.
  • git branch | findstr /v "master" | xargs git branch -D to delete all local branches except master.
  • git branch | findstr /v "master develop branchname" | xargs git branch -D to delete all local branches except master, develop, and branch-name.

Deleting Stale Remote Branches

Stale branch are a branch that has been deleted from the remote repository but are still exists locally.

  • git remote prune origin to delete all stale branch.
  • git branch -d -r origin/branchname to delete specific stale branch.

Git Cheat Sheets

References


  Posts archive


comments powered by Disqus