In git if I have an old feature, lets call it, feature/improvement branched from master master gets like 500 commits, and feature/improvement needs updating I see 3 options.
- Merge master onto feature/improvement
- Merge feature/improvement onto the commit pointed at by master, and changing the branchref of feature/improvement to point to the new merged commit.
- rebase?
2 seems to be the most straight forward option to me, it shows a merge commit, and it shows the old changes, being re-applied to the lastest master changes.
But tools and history get very confused, because it's 'backwards' or 'reversed'
Am I mis-understanding something fundamental? Is there an obvious downside I don't understand?
Why Rebase?
Edit:
As requested, I've created a demo repo of 'reverse merge' I'm sorry for the poor git commands / typo's.
306 touch demo.txt
307 echo "1" > demo.txt
308 git add demo.txt
309 git commit "Master 1"
310 git status
311 git commit -m "Master 1"
312 echo "2" > demo.txt
313 git commit "Master 2"
314 git add .
315 git commit -m "Master 2"
316 git status
317 git log
318 git branch feature
319 git checkout feature
320 echo "a" > demo.txt
321 echo "b" > demo.txt
322 echo "c" > demo.txt
323 git commit -m "feature c"
324 git add .
325 git commit -m "feature c"
326 echo "d" > demo.txt
327 git commit -m "feature d"
328 git add .
329 git commit -m "feature d"
330 git checkout master
331 echo "3" > demo.txt
332 git add .
333 git commit -m "master 3"
334 echo "4" > demo.txt
335 git add .
336 git commit -m "master 4"
337 echo "5" > demo.txt
338 git add .
339 git commit -m "master 5"
340 git branch feature2
341 git checkout feature2
342 git merge help
343 git help merge
344 git merge feature
345 git add .
// This is where I gave up, and Used Source Tree to use a GUI to reset feature to feature2's ref
346 git status
347 git commit
348 git status
349 echo "e" > demo.txt
350 git add .
351 git commit -m "feature e"
352 checkout -b "master"
353 git checkout master
354 git commit -m "master 6"
355 echo "6" > demo.txt
356 git add .
357 git commit -m "master 6"

masteris your authoritative reference branch, I would vote for brining the feature branch up to date with master first. So, either mergemasterinto the feature branch, or rebase the feature branch onmaster.