我只是想使用git bash创建分支,所以任何人都可以给我指导如何做?
To create a new branch:
> git branch newbranch
To create a new branch and switch to it:
> git checkout -b newbranch
In your github fork, you need to keep your master branch clean, by clean I mean without any changes, like that you can create at any time a branch from your master. Each time, that you want to commit a bug or a feature, you need to create a branch for it, which will be a copy of your master branch.
When you do a pull request on a branch, you can continue to work on another branch and make another pull request on this other branch.
Before creating a new branch pull the changes from upstream, your master needs to be up to date.
Create the branch on your local machine and switch in this branch :
$ git checkout -b [name_of_your_new_branch]
Push the branch on github :
$ git push origin [name_of_your_new_branch]
When you want to commit something in your branch, be sure to be in your branch.
You can see all branches created by using :
$ git branch
Which will show :
Add a new remote for your branch :
$ git remote add [name_of_your_remote]
Push changes from your commit into your branch :
$ git push origin [name_of_your_remote]
Update your branch when the original branch from official repository has been updated :
$ git fetch [name_of_your_remote]
Then you need to apply to merge changes, if your branch is derivated from develop you need to do :
$ git merge [name_of_your_remote]/develop
Delete a branch on your local filesystem :
$ git branch -d [name_of_your_new_branch]
To force the deletion of local branch on your filesystem :
$ git branch -D [name_of_your_new_branch]
Delete the branch on github :
$ git push origin :[name_of_your_new_branch]
$ git branch <branch name> // To create a new branch
$ git checkout <branch name> // To switch to a branch
$ git checkout -b <branch name> // Create and switch both
You can merge any branch (say xyz) with your current branch using
$ git merge xyz
Also You can delete a branch using
$ git branch -d <branch name>
And
$ git status
will tell you the branch which you are on (Current Branch)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.