SeattleOrBayArea
SeattleOrBayArea

Reputation: 3118

git removing a file on merge from staging

I have a submodule. I updated a branch, say "x" and committed. Now, I need to update the same changes in branch "Y" which has some difference from X.

So here is what I have been doing, I checkout Y and then run git merge X. Now, there are conflicts. Some of the conflicts are not to be resolved, for example change-logs etc. So the changelog file that I have, debian/changelog is shown to have conflict and another file has a conflict.

What I want to do is, not update debian/changelog while keeping other changes. Please dont down vote at this point. I have been trying a lot of things and read git rm man page as well.

I tried doing this, git rm --cached debian/changelog and it adds it to the list of changes to be committed as deleted. This is causing worry as I dont want this to be deleted on the remote git repository. Please advise.

Upvotes: 1

Views: 132

Answers (1)

VonC
VonC

Reputation: 1326784

Generally, in order to ignore a specific file durng merge (whille keeping that file versioned ion Git), you would set a merge driver with, in this case, a "keepMine" script.

No need for git rm. That script will make sure, in case of conflict for any *.log file (for instance) to always keep the destination file (ie the one one branch Y).

Upvotes: 1

Related Questions