简体   繁体   中英

Pushing a branch to a remote repository in git

I'm trying to update the 3-2-stable branch on my fork of the Ruby on Rails project. So after cloning rails, I initially did a git checkout -b my_branch remotes/origin/3-2-stable . Then I made my changes. Then I added my fork as a remote repository with git remote add my_fork git@github.com:myusername/rails.git . Does a git push my_fork my_branch update the 3-2-stable branch only in my_fork ? Is there something special I need to do?

Does a git push my_fork my_branch update the 3-2-stable branch only in my_fork?

Yes it will. It won't affect any other repo.
Note that the 3-2-stable on your fork won't be impacted either: a new branch my_branch will be created on your fork to reflect your local branch.

But if you want to push/pull that branch from the repo my_fork , then this would make it easier:

 git push -u my_fork my_branch

See " What exactly does the “u” do? “git push -u origin master” vs “git push origin master” " for more on setting the upstream branch of a local 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM