• Now all data be ready for publish, We had made our blog alive now. Haha.



  • These days CCP GFW blocked all the IPs from US and when I switch my IP in google Cloud, the disk data cannot be restore again. I have to restart my blog totally, Now the website is still building…



How do I push a new local branch to a remote Git repository and track it too?- Stack Overflow

Python PingBook 2 months ago (10-26) 16 0

Question

I want to be able to do the following:

Create a local branch based on some other (remote or local) branch (via git branch or git checkout -b)
Push the local branch
to the remote repository (publish), but make it
trackable so git pull and git push will work immediately.

How do I do that?

I know about –set-upstream in Git 1.7, but that is a post-creation action. I want to find a way to make a similar change when pushing the branch to the remote repository.

Answer

In Git 1.7.0 and later, you can checkout a new branch:

git checkout -b

Edit files, add and commit. Then push with the -u (short for –set-upstream) option:

git push -u origin

Git will set up the tracking information during the push.




Copyright from PingBook Blog, If not specified, they are original. This site uses BY-NC-SAProtocol authenticated.
For reprinting, please indicate the link of the original text:How do I push a new local branch to a remote Git repository and track it too?- Stack Overflow
LIKE (0)
[1725641479@qq.com]
SHARE (0)
PingBook
Author:
We create, We sharing! Tag every value data your sharing
Submit comments
Cancel comments
emoji picture bold strikethrough center italic check in

Hi,you need to provide your name and email adress!

  • Name (Required)
  • Email (Required)
  • Website