How do I create my own Git branch to work on?

My goal - to branch of from our development branch to be able to work on it separately. I was quickly shown how to do this as:

  • Open git shell or powershell/cmd and navigate to the folder where the project resides.

  • Run "git branch (desiredNameForMyBranch)". From what I understand this just creates a local branch.

  • Run "git checkout (desiredNameForMyBranch) - this switches to the branch locally?

  • Run "git push origin" - this creates the branch remotely?

  • Is this correct? (We are using github, but it's all the same git, right?). And yes, I realize I need to take a course on this on pluralsight or something, I just don't have four hours today to do it.

    This is similar to what I need, here for reference if other people have the same q later: https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches


    You can do steps 2 ( git branch ) and 3 ( git checkout ) at the same time with git checkout -b branchname

    For step 4, I am accustomed to git push -u origin branchname to explicitly create the branch remotely and set it as the upstream for your working branch. This lets you do git pull later without arguments to update your working copy from the remote branch. See How do I push a new local branch to a remote Git repository and track it too?

    However, you can skip step 4 if you are only doing some short-term local development, depending on your group's chosen workflow. Local-only branches are commonplace + disposable (not replicated).

    链接地址: http://www.djcxy.com/p/4650.html

    上一篇: Git推动不创建远程分支,推动主人

    下一篇: 我如何创建自己的Git分支来处理?