git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What's The Right Way to Do This?

From
Jon Forrest <nobozo@gmail.com>
Date
Sep 23, 2011, 13:45 UTC
Message-ID
<4E7C8D77.4020707@gmail.com>
In-Reply-To
<4E7C27A0.9030900@diamand.org>
On 9/22/2011 11:30 PM, Luke Diamand wrote:
Show 8 quoted lines
> Someone will be along soon to correct me, but I think you should have
> rebased against the master branch rather than merged. Something like:
>
> % git rebase origin
>
> That way your changes would remain appended to the tip of the master
> branch. That will in general make your life much easier for all sorts of
> reasons.

In considering this, I'm having trouble understanding when to do a merge as opposed to a rebase. Let's say that other people weren't putting changed back in the remote master. So, my changes would always be at the tip. Is that when I should merge? If so, then this suggest that knowing what to do depends on knowing what other people are doing. But, doesn't this go against the philosophy of a distributed SCM?

Show 5 quoted lines
> At a guess, git revert created a commit that undid your _merge_, rather
> than your commit. The merge included all those other changes....
>
> It's a good idea to take a look at what a commit does before pushing it
> - "git show HEAD" is your friend.

IIRC, I did this and I saw the collection of the changes I had made plus what other people had made. I didn't know how to revert only my changes.

> Use git rebase (*) to keep your changes nicely arranged at the top of
> the main branch.
Thanks. I'll study up on this.
> I think you could award yourself a nice cup of tea after an experience
> like that though, having been on both sides of it, I can imagine you
> need it :-P
It certainly wasn't my finest hour!
Jon
Previous: Luke DiamandNext: Johannes Sixt
Message 4 of 6 in “What's The Right Way to Do This?”
  1. Jon ForrestSep 23, 2011
  2. Michael WittenSep 23, 2011
  3. Luke DiamandSep 23, 2011
  4. Jon ForrestSep 23, 2011
  5. Johannes SixtSep 23, 2011
  6. Junio C HamanoSep 23, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.