How do I get the current branch name in Git?
To display only the name of the current branch you’re on: git rev-parse –abbrev-ref HEAD Reference: Show just the current branch in Git
To display only the name of the current branch you’re on: git rev-parse –abbrev-ref HEAD Reference: Show just the current branch in Git
First, create a new local branch and check it out: git checkout -b <branch-name> The remote branch is automatically created when you push it to the remote server: git push <remote-name> <branch-name> <remote-name> is typically origin, which is the name which git gives to the remote you cloned from. Your colleagues may then simply pull … Read more
Given a branch foo and a remote upstream: As of Git 1.8.0: git branch -u upstream/foo Or, if local branch foo is not the current branch: git branch -u upstream/foo foo Or, if you like to type longer commands, these are equivalent to the above two: git branch –set-upstream-to=upstream/foo git branch –set-upstream-to=upstream/foo foo As of … Read more