GIT how to update branches with different files
I’m having a master branch with english texts and another branch called german_translation.
The german branch is identical with the master branch – but the german branch has an additional folder
/value-de with one file in it
- No stash found when using git stash branch
- Git pushing to remote origin—changes are not commited in origin, only visible after git stash
- Wrongly applied git stash to a different branch
- How can I stash my changes and go back to my last check-in in Git?
- Git: How to store 'git stash' Data
- Git stash pop- needs merge, unable to refresh index
When adding new stuff to the master branch, I want to update the german branch with the new stuff from master and add new translation text to the german strings.xml.
My problem is that a merge is not working because of that extra file and folder the german branch has.
Is that a un/stash thing?
However can you describe the full steps going throu this branch update process?
Thanks in advance!
EDIT: This is the error message I’m getting
Can’t merge because of unmerged files. You have to resolve all merge conflicts before merge. After resolving conflicts you also probably would want to commit your files to the current branch.
EDIT2: (that’s german …)
git status # Auf Branch german_translation # Sie haben nicht zusammengeführte Pfade. # (beheben Sie die Konflikte und führen Sie "git commit" aus) # # zum Commit vorgemerkte Änderungen: # # geändert: src/main/res/values/strings.xml # # Nicht zusammengeführte Pfade: # (benutzen Sie "git add/rm <Datei>..." um die Auflösung entsprechend zu markieren) # # von denen gelöscht: src/main/res/values-de/strings.xml #
One Solution collect form web for “GIT how to update branches with different files”
One possibility is that the file values-de/strings.xml was at one point present on the master branch, and subsequently deleted. In the meantime, on the german translation branch, the same file had updates not present on the master branch.
When the next merge from master occurred, it included the delete operation for the values-de/strings.xml, but since there are updates on the branch, it couldn’t be completed, instead resulting in a merge conflict.
Right now git is asking you to resolve this merge conflict manually, i.e., which takes precedence, the deletion of the file, or the changes made to it on this branch?
If you want to keep the file with the changes, then execute
git add src/main/res/values-de/strings.xml git commit
if not, you would execute:
git rm src/main/res/values-de/strings.xml git commit
This would complete your last merge, so now you can merge again to get the latest.
Also, you may want to consider keeping your german translation in the master branch. Branches are generally for keeping past versions or for feature development.