When I used gitk to check my branches, I found the following:

I created pretty_url, switched to it, worked on stuff, committed, then switched to master branch (which was clean), then ran git merge pretty_url, and checked with gitk, and found this.
I'm sure this is not proper and probably the master wasn't clean. How can I fix this?
That's exactly what you should expect from a merge. If you wanted to rebase and fast-forward, you could have done that instead and had a straight line.
Example:
Before the merge, you had this situation:

That is, the history of master and branch diverged. They share h as a common ancenstor. When merging (via git merge branch while on `master), you end up with a commit with two parents to unify that history:

If that's not what you wanted, you can undo that and get what you wanted by doing something like:
git reset --hard HEAD@{1} # or whatever commit matches 'j' to undo the merge
git checkout branch
git rebase master # incorporate 'i' and 'j' commits into 'branch'
git checkout master
git merge branch # this merge will be a fast-forward now
Which will give you the rebased linear history you seem to be looking for:

The red line does not indicate an unclean branch; it just means that the previous commit in master is older than pretty_url's head. No need to worry here. Moreover, git merge does not work on unclean trees.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With