feature/XY is the name of a feature branch and is currently checked out. feature/XY-refactor is the name of another branch, that branched off of feature/XY.
When I run git log --oneline, I get the output below.
What does it mean that these two are right one after the other at the very top of the log output? I am using git bash on Windows.
user@host ~/Documents/repo (feature/XY)
$ git log --oneline
9feb11a (HEAD -> feature/XY, origin/feature/XY) Axis labels
d250b90 (feature/XY-refactor) Refactored
87d49c1 Fix typoe
6a8a7c7 Fix print statement
945ffca Fix code layout
3e747c9 Added spaces after comma
b143713 Changed fontsize
a669cd4 Commented out a print statement
// .. more commits
git logwill return all the commits reachable from a specific commit or set of commits (i.e. the history up to the specified commit(s)). When you don't specify a commit, it defaults toHEAD.So you effectively ran
git log --oneline HEADwhich is equivalent togit log --oneline feature/XY(the checked out branch).Thus your
git logresult is telling you that yourfeature/XYbranch has as its parent (or one of its parents if9feb11ais a merge commit) the last commit of thefeature/XY-refactorbranch. In other words, thefeature/XY-refactorbranch has been merged intofeature/XYone way or another.git logshows a list of commits in chronological order but not their exact relationships. To see that use the--graphswitch, which works especially well with--oneline:For example, if
feature/XY-refactorbranched off at commit3e747c9, and was then merged withfeature/XYbefore any separate work was done onfeature/XYyou would see the following:Or if
feature/XYwas rebased ontofeature/XY-refactor, you would see the following:When you use
--graph, it may reorder the commits to make a cleaner graph.There is one flaw with
git log --graph: It doesn't make it obvious when you have two or more separate commit histories that don't share a common root commit. But that is unlikely to be your case based on what you said.Anyway, you can always see the history for any particular ref or "commitish" by giving it as an arg to
git log. Try these commands:If you want to see how two or more branches relate:
If you want to see ALL branches:
As a bonus, here's an even more detailed
git logcommand, showing dates, times and author: