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

Splitting code between files and then merging

From
nathan bullock <nathanbullock@gmail.com>
Date
Apr 15, 2008, 01:22 UTC
Message-ID
<916b88c10804141822m45588ae9x7492867b749cc53c@mail.gmail.com>

I have been playing around with various merge situations and things don't seem to be working quite as I expected.

If I have a repository with a file such as:
### file abc ###
void
foo(){
  int x;
  func(x);
}
void
moo(){
  int y;
  func(y);
}
And then clone that repo and in my clone I edit things so that I have two files:
### file abc ###
void
foo(){
  int x;
  func(x);
}
### file bcd ###
void
moo(){
  int y;
  func(y);
}
I commit this.

Then I do a git blame -C -C6 bcd (If I make these functions larger I can get away with just a single -C)

It seems to be able to determine that all of the lines in both files originated from the file abc.

Now the problem is that if I make a change to the function moo in the file abc in the original repo and the try to pull it into the second repo I always get merge conflicts. Is this expected? Do any of the various merge algorithms in git handle these situations?

Nathan Bullock
Message 1 of 1 in “Splitting code between files and then merging”
  1. nathan bullockApr 15, 2008

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.