Git/TortoiseGit: Merge Between Base Project and Derived Project
May 5, 2023•162 words
Situation
Need to merge between 2 projects which are not to be the same. Some files are to be identical but some files are to be different.
Git Commands
git checkout base-dev
# Both --no-ff and --no-commit are required:
git merge dev --no-ff --no-commit
git reset
git checkout path/to/file/to/be/different
git add -A
git commit -a -m Msg
git push
TortoiseGit
Preparation
- To see different files between 2 branches (1 of base project, 1 of derived project)
- Open
Windows Explorer
- Context menu >>
Browse References
- Ctrl + click to choose 2 branches
- Right click and choose
Compare selected
- Open
Steps
- Context menu >>
Git Merge
- On merge dialogue, tick both
No Fast Forward
,No Commit
- See changed files by: Context menu >>
Git Diff
- Choose code blocks of each file in a list shown, TortoiseGit possibly does this part with both (reset+save, not checkout)
- Add, commit, push as usual.