This is a post mostly for myself. Einstein said that you truly understand something if you can describe it to a 7-years old.
So, this is my attempt to explain something to myself in a blog post. :))
The “problem”?
Here’s what I often wonder is which is the incoming
and which is the current
change. Of course, you are thinking it’s very obvious then you’re probably right. But hey, some of us are not that quick thinking… apparently. ;)
My development workflow
- Create a
feature
branch frommaster
. - Add some stuff there.
- Rebase
feature
on top ofmaster
. - Open a pull (merge) request.
When the lighting strikes
If there are no conflicts between feature
and master
step 3 “just happens”. However, if there are, you see the following dialog in VS Code:
I’ve annotated what is coming from master
and what is from the feature
branch. To understand why the current change is from master
should be obvious if you know how rebase
works in git
.
How does rebase work?
rebase
gets the branch name you’ve given and then replays all of your commits on top of them. In our case, this means master
is the current
and while every change that is applied is an incoming
one.
Conclusion
That’s it! Now I’ve explained this to myself, hopefully I won’t be thinking this every time I need to resolve a conflict in VS Code.
Please note, if you are using merge
to integrate master
to your feature
branch the “roles” are reversed! But hey, don’t do that, make the reviewers’ life easier! ;)