Earlier quoted context omitted.
Whether a branch is private and therefore can be rebased has nothing to do with whether there's a copy of it on the server. I push my work-in-progress to the server often for backup purposes anyway. If I want to rebase, I just push -f. I can't think of why that would be a problem, but if someone objected to push -f on a private branch, I'd just make a new branch with a new name and push that. And if that were a probl…
This is true. If the assumption is that it's a private branch, then other people shouldn't care if you push -f because no one else should be using it. Sometimes there are cases where people want to pull a private branch because they are working on something that is in the same code path but will be deployed after the private branch is integrated and deployed. They want to work off the newest code and avoid a larger m…
Understanding the Git Workflow
71–78 of 78 posts
Re: Understanding the Git Workflow
#72Earlier quoted context omitted.
Try http://hginit.com for a fantastic introduction to Mercurial for people familiar with SVN (or not). Git was designed to suit kernel development (as shown in the article). For us simple-minded mortals who like SVN, it is much easier to migrate to Mercurial.
Good article, well written. If we are to start using distributed version control then I guess it might as well be git since it seems to have the most traction in the press.
That is a plugin for Mercurial, written by the Github people, to support targeting git repositories.
Re: Understanding the Git Workflow
#73The idea that fast-forward merges are easier to follow is subjective. I find my --no-ff history easier to read. This author doesn't. What always using fast-forward merges really means is that you rebase each branch onto master once it's ready to be public. Therefore, instead of resolving conflicts when the branch is merged, the commits are rewritten to avoid introducing the conflict in the first place. Sometimes, thi…
In my experience, on large distributed projects the person integrating changes into master is rarely the same person who authored the change. For example, when Linux branches are pulled upstream, if your code creates a conflict your branch will just be rejected and you'll be told to fix. Rebase forces the author to solve more of these problems before submitting their change for integration. I don't think rebase is an…
Re: Understanding the Git Workflow
#74Earlier quoted context omitted.
How are they useful? Why would anyone care about how you developed a single bugfix or a feature? In your model, often the commits are not even sequential in the log because you might find a mistake only after committing several other changes. I can't see how not rebasing makes commit history better in any way at all . I would like to hear your reasoning. The way I see it, instead of a series of commits that implement…
> How are they useful? Why would anyone care about how you developed a single bugfix or a feature? In my opinion in a collaborative environment it is immensely useful to know about how a feature / bug fix was developed. Hiding away the development of a feature into one large commit makes it harder for people to review. > I do not think that this is a matter of opinion or preference. That would imply that both approac…
this is exactly what be pro-rebasers were talking about.
Nobody of us wants to do one big huge commit that contains the whole feature.
Everybody of us wants small, self-contained commits, every commit fixing or adding one specific thing.
What we don't want is a commit adding a thing, quickly followed by another commit "forgot to add this file", because that later commit provides no value to a reviewer.
What we rebasers are talking about is forging the history in a way that a patch reviewer can go over every single commit and, in one glance, decide whether that patch makes sense or not.
Let's assume it's the old days of svn: A whole file is the smallest unit of change you can commit and there's no way to change history.
Let's further assume that you want to add a new feature to a file. While doing so, you also notice that there's a bug in another part of that code in the same file that became apparent while writing your feature.
Your feature only works with the bug fixed, but the bug fix also makes sense independently of the feature.
In the old days, when committing that file, you have two options for commit messages:
1) "adding feature foobar"
leaving out the fact that you also fixed a bug. This is bad if your bugfix contains another bug and I have to dig in the history, wondering why you changed this seemingly unrelated piece of code. If I have to review the code, I will have to ask you, why you also changed a seeminly unrelated piece of code.
2) "adding feature foobar and fixing bug bar"
this is better, but weren't you thought that a commit should only do one thing? This clearly does two.
At that point, you could use diff, patch and an editor to remove the feature but leave the bugfix in. Then you commit that as "fixing bug bar", followed by more diff and patch to get the feature in, which you commit as "adding feature foobar".
Fine, but very cumbersome, so hardly ever done.
Git, on the other hand, with the help of "add -p" and "rebase -i" makes exactly this possible and turns something incredibly painful into something you can do with closed eyes in your sleep.
And this is why there is this vocal pro-rebasing-crowd.
We EXACTLY NOT talking about mushing everything together in a big commit
We are talking about creating MANY, MANY more SMALLER commits that are independent of each other and thus much more maintainable.
Case in point: Since we migrated to git for our product and since everybody learned about rebase and began using it, we made the same amount of commits in one year that we did in tree previous years.
I would be seriously upset if somebody used the power of rebase to create big huge commits and wanted to push them to our main repo. This is not what we are advocating rebase use for. Not at all.
Re: Understanding the Git Workflow
#75Earlier quoted context omitted.
How are they useful? Why would anyone care about how you developed a single bugfix or a feature? In your model, often the commits are not even sequential in the log because you might find a mistake only after committing several other changes. I can't see how not rebasing makes commit history better in any way at all . I would like to hear your reasoning. The way I see it, instead of a series of commits that implement…
> How are they useful? Why would anyone care about how you developed a single bugfix or a feature? In my opinion in a collaborative environment it is immensely useful to know about how a feature / bug fix was developed. Hiding away the development of a feature into one large commit makes it harder for people to review. > I do not think that this is a matter of opinion or preference. That would imply that both approac…
You have it backwards. One commit is much easier to review than three commits that you might not even know are related.
Assuming you know what you're doing, the commits you create with rebase are not large, they are just the perfect size. They contain the code needed for a single change and nothing else.
Sometimes a feature might actually take two or more commits, but then those commits represent two subfeatures... For example, you might first need to implement a new API, and then write a new feature that uses that API. That's two commits. If you forget something from the API or notice that it's problematic while coding the feature, then rebase will allow you to fix the first patch, instead of splitting code across multiple commits that make no sense separately.
One might argue that in this situation the feature patch makes no sense without the API patch but in fact it's a feature dependency, not a code dependency... As long as the API exists, the feature implementation is just fine as a standalone commit.
When used properly, rebase gives you freedom to use as many WIP commits and make all the mistakes you want in your private branch, while still allowing you to create good, easy-to-review patches that result in a logical, clean, and informative history.
If you still hold the opinion that rebase is bad, I am interested in further arguments, since the one reason you gave does not hold water.
Re: Understanding the Git Workflow
#76Earlier quoted context omitted.
In my experience, on large distributed projects the person integrating changes into master is rarely the same person who authored the change. For example, when Linux branches are pulled upstream, if your code creates a conflict your branch will just be rejected and you'll be told to fix. Rebase forces the author to solve more of these problems before submitting their change for integration. I don't think rebase is an…
A --no-ff merge also makes reverting a change from master easier because there is just one commit. You don't need to dig through the log to find the first commit from the merged branch fast-forwarded onto master.
using "git revert " is very nasty[1]. using 'git reset is less so.
[1]http://kernel.org/pub/software/scm/git/docs/howto/revert-a-f...
Re: Understanding the Git Workflow
#77Earlier quoted context omitted.
This is true. If the assumption is that it's a private branch, then other people shouldn't care if you push -f because no one else should be using it. Sometimes there are cases where people want to pull a private branch because they are working on something that is in the same code path but will be deployed after the private branch is integrated and deployed. They want to work off the newest code and avoid a larger m…
If someone wants to work off my private stuff I would tell them "sure, but be careful cause I'm push -f'ing" (after all, it's usually pretty easy to fix) and give them a heads-up when I do. If that weren't acceptable, I'd add a tag like "stable" to my branch, tell them to use it only up to that tag, and move the tag forward as the work progresses. If that weren't acceptable I'd make a branch instead of a tag and tell…