In Git 1.7.0 and later, you can checkout a new branch:
git checkout -b <branch>
Edit files, add and commit. Then push with the -u
(short for --set-upstream
) option:
git push -u origin <branch>
Git will set up the tracking information during the push.
Related Posts:
- How do I push a new local branch to a remote Git repository and track it too?
- How do I push a new local branch to a remote Git repository and track it too?
- How do I delete a Git branch locally and remotely?
- How do I delete a Git branch locally and remotely?
- What does ‘–set-upstream’ do?
- What does ‘–set-upstream’ do?
- error: src refspec master does not match any
- What is the difference between git push origin and git push origin master
- How do I rename both a Git local and remote branch name?
- How do I push a local Git branch to master branch in the remote?
- How do I rename a local Git branch?
- What is the best (and safest) way to merge a Git branch into master?
- How do I properly force a Git push?
- How to remove local (untracked) files from the current Git working tree
- Git merge hotfix branch into feature branch
- GitHub: Permission denied (publickey). fatal: Could not read from remote repository
- Git fetch remote branch
- How do I clone a specific Git branch? [duplicate]
- Git fetch remote branch
- How do you push a tag to a remote repository using Git?
- How to change the URI (URL) for a remote Git repository?
- How to get just one file from another branch?
- Update Git branches from master
- Create a branch in Git from another branch
- Create Git branch with current changes
- How to get the current branch name in Git?
- How do you create a remote Git branch?
- Move the most recent commit(s) to a new branch with Git
- Move the most recent commit(s) to a new branch with Git
- Make an existing Git branch track a remote branch?
- How do I call git diff on the same file between 2 different local branches?
- How to get the current branch name in Git?
- How do you create a remote Git branch?
- Meaning of the GitHub message: push declined due to email privacy restrictions
- Download a single folder or directory from a GitHub repo
- Branch from a previous commit using Git
- Clone A Private Repository (Github)
- How do I rename a repository on GitHub?
- How to remove remote origin from a Git repository
- Not a valid object name: ‘master’
- ! [rejected] master -> master (fetch first)
- How do I copy a version of a single file from one Git branch to another?
- Git: Merge a Remote branch locally
- Undoing a ‘git push’
- Move existing, uncommitted work to a new branch in Git
- What are the differences between “git commit” and “git push”?
- What does git push origin HEAD mean?
- What does git push origin HEAD mean?
- Delete branches in Bitbucket
- Git’s local repository and remote repository — confusing concepts
- Repository size limits for GitHub.com
- How do you clone a Git repository into a specific folder?
- How to keep a branch synchronized/updated with master?
- Can I arrange repositories into folders on Github?
- Git removing upstream from local repository
- How do you merge two Git repositories?
- How do I run git log to see changes only for a specific branch?
- How to create a local branch from an existing remote branch?
- How do I clone a subdirectory only of a Git repository?
- How to find which git branch I am on when my disk is mounted on other server
- Git push hangs when pushing to Github?
- How to create a new branch from a tag?
- Git push requires username and password
- Could not find wp-load.php issue
- Git refusing to merge unrelated histories on rebase
- What does “Changes not staged for commit” mean
- How can I merge multiple commits onto another branch as a single squashed commit?
- Why does git say “Pull is not possible because you have unmerged files”?
- Pushing empty commits to remote
- How do I ignore an error on ‘git pull’ about my local changes would be overwritten by merge?
- Stash only one file out of multiple files that have changed with Git?
- What is git fast-forwarding? [duplicate]
- How to cherry-pick multiple commits
- Reset local repository branch to be just like remote repository HEAD
- What is “origin” in Git?
- Another git process seems to be running in this repository
- How do you stash an untracked file?
- How to git rebase a branch with the onto command?
- Remove a git commit which has not been pushed
- How can I make Git “forget” about a file that was tracked, but is now in .gitignore?
- How do I ignore an error on ‘git pull’ about my local changes would be overwritten by merge?
- How to undo git reset –soft to get my changes back?
- .gitignore and “The following untracked working tree files would be overwritten by checkout”
- git – Your branch is ahead of ‘origin/master’ by 1 commit
- Git: How to update/checkout a single file from remote origin master?
- Git pull origin
overwrites master? - ERROR: Error cloning remote repo ‘origin’
- How can I remove a commit on GitHub?
- What is the difference between ‘git remote update’, ‘git fetch’ and ‘git pull’?
- GitLab remote: HTTP Basic: Access denied and fatal Authentication
- What to gitignore from the .idea folder?git intellij-idea gitignore webstorm
- git checkout master error: the following untracked working tree files would be overwritten by checkout
- How can I see the changes in a Git commit?
- Git pull – Please move or remove them before you can merge
- Unlink of file Failed. Should I try again?
- Resetting remote to a certain commit
- Git checkout – switching back to HEAD
- Workflow for working with git and WordPress
- best practice on pushing staging development (database/uploads) to the live server
- How to retrieve the last modification date of all files in a Git repository