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

Re: merge only some of the changed files?

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Mar 19, 2010, 13:55 UTC
Message-ID
<4BA3825E.1070700@drmicha.warpmail.net>
In-Reply-To
<20100319134028.GA2318@comppasch2>
fkater@googlemail.com venit, vidit, dixit 19.03.2010 14:40:
Show 9 quoted lines
> Hi all,
> 
> I am quite new to git.
> 
> If I want to merge branch B into A, however not all of the
> changed files in B, how do I do that?
> 
> In other words: 'git diff --name-only A..B' lists 10 files
> but I want to merge only 5 of them.

If you are sure you don't want to merge the changes to them later on, you can do the following while on branch A

# perform the merge but do not commit git merge --no-commit B # overwrite the files you want to keep with their version from A git checkout HEAD -- file1 file2 # commit the merge result git commit

Cheers, Michael

Previous: fkater@googlemail.comNext: Thomas Rast
Message 2 of 3 in “merge only some of the changed files?”
  1. fkater@googlemail.comMar 19, 2010
  2. Michael J GruberMar 19, 2010
  3. Thomas RastMar 19, 2010

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.