r/ProgrammerTIL • u/eadgar • Jul 28 '20
Other Didn't realize for years that pull requests create a merge branch
I always thought I had to merge back from target to source to get the latest fixes in my PR if something had changed in the target, but it turns out CI builds use the hidden merged branch. It's only if you want the latest changes locally you need to do a merge/rebase. đ¤ˇââď¸
I've mostly been using TFS.
39
Upvotes
4
u/parkerSquare Jul 28 '20
The useful trick is getting your PR to rebuild (on a candidate merge branch) whenever the target branch changes - does this happen automatically yet?
45
u/thefirelane Jul 28 '20
This is not a universal rule
10
u/Crozzfire Jul 28 '20
I would recommend to keep merging into your own branch first anyway. It's good practice, you can run tests first on it and in case there are conflicts you can resolve them without a surprise.
1
u/Corporate_Drone31 Jul 28 '20
In git, you have an option to either do a PR based on a merge commit or on a fast-forward, so a third branch won't be always used.
1
u/slaymaker1907 Dec 25 '20
This can actually cause problems with large projects. In order to make sure the merge doesn't break tests, you effectively have to lock merging and wait for the merge to complete before someone else can create their merge branch and begin testing.
You could anticipate that the earlier persons changes will get merged in, but it doesn't seem like many systems do this.