top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Marking a branch "closed" in GIT?

+1 vote
526 views

Lets say I've got a topic branch. I've made a bunch of commits. It's messy. But it's done.

As I understand it, best practice is to do a squash commit of the whole thing onto the parent branch (develop or master, depending on workflow). And I can do that.

What do I do with the leftover? I thought I could tag it as "closed", but I can't use the same tag more than once. What's the best way to mark it as done, or should I just delete the branch label and let it be garbage collected/deleted?

posted Jul 20, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

Depends on your workflow. For one project, I interactive-rebase my feature branches often, and merge them into master when they are finished; after that, they can live forever in the repository, and if the feature needs a fix or change, I can check them out.

For another project, I squash-commit the feature branch then delete it. In a third one I squash and don't delete. You decide :)

answer Jul 20, 2016 by Ahmed Patel
0 votes

Squashing makes sense if you have a really ratty bunch of checkins with work-in-progress checkins etc., but unless its a trivial topic branch I would still typically make the final set of commits into a few logical steps.

It costs pretty much nothing to leave old topic branches around (but a few thousand "nothings" can add up :-)).

Once you have merged a topic branch you can safely delete the branch with no harm (apart from losing the branch itself).

As Ahmed says it depends on your workflow.

For example lets say you are using some fault tracking database (eg. trac). It often makes sense to do the fix on a topic branch (eg. fix-trac-1234). If you leave the branch in place after merging it you can then refer to the branch in the trac notes and see what fixes were used to fix the bug (and reopen the bug if it needs another kick).

answer Jul 20, 2016 by Sidharth
Similar Questions
0 votes

When I update my branch from master it pulls down several files, including some sass files. When I compile, however, gulp alerts me that I am missing .scss files.

I tested this by creating a new fresh branch and running gulp sass. This time there were no errors and I saw the missing .scss had been brought in.

Would anyone know why, on update, I am only getting some of the files from master?

+1 vote

For a project I use git with a dev branch. If it get's stable, it is merged to master. Now I have to maintain different versions of the software. (for example v1.0 and v2.0)

What is the best way to handle a hotfix for the old version v1.0? I know, I can create a hotfix branch. But what to do after that? Should I maintain this hotfix branch forever or is it better to merge the hotfix somehow into the master branch?

Currently I have to integrate a hotfix for v1.0. It's about a feature, which was removed in v2.0. So I think it's not a good idea to merge it back to master. But is it really a good idea to maintain a long running branch for every version?

+2 votes

I would like to know what are the best practices when creating a new branch. For example. If I get a request to do update website title from XYZ to ABC; then should I create a branch named; "Update Title"? Or I should prefix this as suggested here (http://stackoverflow.com/questions/273695/git-branch-naming-best-practices). Are there any official prefixes?

Also I am concerned about the following; Let us say I create the branch named "Update Title". Finish the change. Merge back with Master. I then get another request to change title from ABC to DEF. Can I create another branch "Update Title". Will not this be confusing?

+1 vote

There's a challenge that i'm currently facing after migration from WINCVS to GIT. The problem here is I need to pull/fetch a specific branch (and NOT clone the entire repository) from the repository to a particular location on the AIX server.

Earlier while using WINCVS this functionality was achievable using JCVSExport package as we could just checkout a particular branch and fetch the package on to the server location.
WINCVS Command : java JCVSExport -h cvs.xyz.com -u abcde -p xxxxxx -d /abcd/cvs/testing -c "$REPOSITORY" -m "$PACKAGE"

I am not able to achieve the same functionality using GIT. I DO NOT want to clone the entire repository on the AIX server instead I just want to fetch/pull a specific branch contents on the server. Can someone please help me out with the solution or any possible way with which I can achieve the same functionality.

+2 votes

In our current setup, we have automatic tagging in git of all successful release builds. This makes it easy to go back to stable points in history and compare functionality, check when bugs were introduced etc.

To help with this process further, it would be useful to be able to use git bisect, but as these are just a sequence of tags, not commits on a branch, git bisect will not work as is.

Is there any tooling for automatically recreating a branch from a sequence of tags, where each generated commit is the calculated delta between each two neighboring tags?

...