What we’re trying to tackle today is a very common problem, that I’m sure all of you encountered. Suppose you’re on your git feature branch, you want to merge it into another branch (being it master, staging, production, whatever) and you’re asking yourself: will there be conflicts?.
If you’re using Github, you can simply open the Pull Request page for your feature branch and look for the following box:
This is informing you there will be no conflicts and a merge will run smooth.
But what could you do if you didn’t use Github, or you were just too lazy to open it? Creating a new branch just to do the merge is a solution, but I was pretty sure git had something better to offer
The best solution I found here on StackOverflow is this: create the following git aliases in your
The first command will show the changelog for the merge of your feature branch into master:
This is showing us there will be a conflict when trying to merge the
feature_two branch into
staging: the file
first_file is changed in both the branches, and this will generate a conflict.
The second command is just a shorthand that will limit the output to the lines related to the changed files, without the full changelog.
I hope you found this interesting, feel free to comment if you think it’s still improvable!