Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does git "added by us" mean?

Tags:

git

git-rebase

After a git rebase I have merge conflicts to solve. I'm confused by the meaning of "added by us" on A.java. What prevents it being automatically added/staged as a new file like C.java?

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   com/company/C.java

Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add <file>..." to mark resolution)

        added by us:     com/company/A.java
        both modified:   com/company/B.java

git version 2.5.1.windows.1

like image 675
chrisjleu Avatar asked Jun 01 '16 08:06

chrisjleu


People also ask

What does deleted by us mean in git?

For some conflict notifications, Git will include a "Deleted by us" or "Deleted by them" message next to a file. That means that you modified a file in one branch and deleted it in another. Git has no way of knowing if you want to delete the file or modify it, so you need to make the choice yourself.


1 Answers

"git rebase" is clunky and obtuse, but oh so useful. To summarize what I think is going on in your case, a rebase "merge conflict" is produced by the "both modified". You have to pick which mod you want - the "com/company/B.java" mods on their branch, the mods on your branch or some combo of both. The "added by us:" is telling you that "com/company/A.java" is new to your branch and was brought in by the branch you're rebasing against. But due to the way git implements rebase, "us" is really their branch. Not sure if this is counted as a rebase "merge conflict" unless you deleted "com/company/A.java" on your branch, the target of the rebase. In that case, that would be a rebase "merge conflict" that you would have to solve. To resolve such a "merge conflict," remember "us" is really their branch and "theirs" is really your branch. Blah.

like image 124
BoiseBaked Avatar answered Sep 18 '22 17:09

BoiseBaked