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

Re: merging individual files

From
CMChris Marshall <christopher.marshall@merchantlink.com>
Date
Aug 14, 2009, 16:14 UTC
Message-ID
<loom.20090814T160738-200@post.gmane.org>
In-Reply-To
<4A858B3B.3000208@drmicha.warpmail.net>
Michael J Gruber <git <at> drmicha.warpmail.net> writes:
Show 23 quoted lines
> > If you're on br1, I would:
> > 
> > git rebase -i X^
> > # change "pick" to "edit" in front of X in the list you get
> > git checkout X^ -- f3 f4 f5
> > git commit --amend
> > git checkout X -- f3 f4 f5
> > git commit
> 
> followed by
> 
> git rebase --continue
> 
> of course ;)
> 
> > 
> > For the 2nd commit, using the -c option may be beneficial.
> > 
> > Cheers,
> > Michael
> > 
> 
> 
Michael:
Thanks so much for your help, this is a lot of fun!

It occurs to me that another way (that doesn't use rebase) would be this: git branch -m br1 br1-old git checkout br1-old git reset HEAD~ git checkout -b br1 git add f1 git commit -m "f1" git add f2 f3 git commit -m "f2" git branch -d br1-old (history eraser button ;-)

git checkout master git merge br1~ (which now only pulls f1's changes) (work for a while) git merge br1 (which now pulls f2 and f3).

I like this sequence because it's so explicit about what's going on.

Are there any conceptual problems going this route that I am missing that might screw up history?

Chris Marshall
Previous: Michael J Gruber
Message 6 of 6 in “merging individual files”
  1. Chris MarshallAug 13, 2009
  2. Michael J GruberAug 14, 2009
  3. Chris MarshallAug 14, 2009
  4. Michael J GruberAug 14, 2009
  5. Michael J GruberAug 14, 2009
  6. Chris MarshallAug 14, 2009

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.