Sometimes we have a POC(Proof of concept) branches, which are forked off the main/feature branches. After a while when POC is complete, we/the dev no longer uses it.
Now over time the no of such POC branches increase and the repo doesnt look good.
So during our periodic maintenance and cleaning of GIT repo, we delete all such POC branches.
How to sync your local branch list.
Simple:
After fetching, remove any remote-tracking branches which no longer exist on the remote.
Similarly, if you are have created a local branch and committed some changes while the remote tracking branch is not present at origin, issue:
where -d = --delete
Delete a branch. The branch must be fully merged in its upstream branch, or in HEAD if no upstream was set with --track or --set-upstream
PS: Before running any delete related operation on branch its better to double check and understand what you are doing!.
Now over time the no of such POC branches increase and the repo doesnt look good.
So during our periodic maintenance and cleaning of GIT repo, we delete all such POC branches.
How to sync your local branch list.
Simple:
where -p = --prune[parag@paragpc: ~/ProjectCodeName] git fetch -px [deleted] (none) ->origin/POC-webCachex [deleted] (none) ->origin/POC-CDNChange[parag@paragpc: ~/ProjectCodeName]
After fetching, remove any remote-tracking branches which no longer exist on the remote.
Similarly, if you are have created a local branch and committed some changes while the remote tracking branch is not present at origin, issue:
[parag@paragpc: ~/GitProject] git branch -d <the_dirty_poc_branch>
where -d = --delete
Delete a branch. The branch must be fully merged in its upstream branch, or in HEAD if no upstream was set with --track or --set-upstream
PS: Before running any delete related operation on branch its better to double check and understand what you are doing!.