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 withgit 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 dogit 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).