What git gotchas have you been caught by?

后端 未结 9 2103
半阙折子戏
半阙折子戏 2020-12-25 08:51

The worst one I\'ve been caught by was with git submodules. I had a submodule for a project on github. The project was unmaintained, and I wanted to submit patches, but co

9条回答
  •  爱一瞬间的悲伤
    2020-12-25 09:26

    Create a new branch:

    git branch new-branch
    

    Work, commit, work ... Realise all my work is on master, not on the new branch.

    I should have done:

    git checkout -b new-branch
    

    Why can't I do something like:

    git branch -c new-branch
    

    (c for checkout) with an option to make that the default behaviour???

提交回复
热议问题