Ahmad 'Abe' Baehaki
Adding Remote Git
git remote add origin https://github.com/user/repo.git
to add remote withorigin
as the name andhttps://github.com/user/repo.git
as the URL.
Deleting Local Branch
git branch –D branchname
to deletebranchname
.git branch | findstr /v "master" | xargs git branch -D
to delete all local branches exceptmaster
.git branch | findstr /v "master develop branchname" | xargs git branch -D
to delete all local branches exceptmaster
,develop
, andbranch-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.