Search code examples
gitsourcetree

Branch before first commit?


In the following Atlassian SourceTree screenshot of my Git repository, there is a straight violet line without initial point. It suddenly appears at "Merge branch tom".

Current git graph

Ideally, I want the graph to look like the following instead:

Desired graph

The Git repository is available at https://github.com/coditers/WEB. My Github username is "student777" and I probably made a mistake. I did many operations, such as git rebase, git merge, git checkout... But I failed to fix it.


Solution

  • I can't help but wonder whether the graph you shared in your screenshots that I assume is rendered by Atlassian Source Tree, is wrong. Cloning your repository as shared in comments, and running git log --all --graph --decorate --always --oneline gives me the following output (snipped but whole towards the first commit(s)), take special note around commit b56b6db (emphasized):

    |/
    *   83ef4a5 Merge branch 'client-controller'
    |\
    | * 2085ee5 client controller complete but validation not yet
    * |   c98eb8e Merge branch 'master' of https://github.com/coditers/WEB
    |\ \
    | |/
    | *   b56b6db Merge branch 'tom'
    | |\
    | | * a315627 repository & myBatis setting: getList(), get(), insert() 구현
    * | | 7c48b31 front-end template complete2
    |/ /
    * | 36b21d8 front-end template complete
    |/
    * 884104f appContext path
    *   794bc68 merge conflict resloved
    |\
    | * dc4be77 readme.md branch-test
    * | 8a60e94 master-commit
    |/
    * 4870ac9 index, registExcel, signinform, signupform .jsp complete
    *   4c99757 merge branches
    |\
    | * d0138be front-end initial commit
    * | 0d46d2a project setup, controller test complete
    * | b5479f8 make a big deal
    * | 709a12c repo, vo, service completed
    * | e511f42 mybatis mapper skel-code complete
    |/
    * 6e3b34a .gitignore added
    * b4fac64 readme test 2
    * 68b182f readme test
    * 32f429e Configuration setting complete
    * 0587e24 readme update
    * 7d8187b initial commit
    * 93ef1da Initial commit

    This answer is currently incomplete, as we would need your input on what would you like to be done to the graph, given how git log displays it. When you update your question according to this information, I may update my answer. Otherwise I suggest you leave the question open so it may benefit someone stuck in the same situation.

    I do not think this is an uncovered bug in Atlassian, that software has some track record, but do color me perplexed and do open an issue with them if you find something that points in direction of a bug.

    By the way -- it is possible to have multiple origin commits without any parents. This is usually done with git checkout --orphan to create a branch pointer that initially would produce a commit without parent, the so-called "initial" commit, even if there already is a number of commits along the master or any other branch.