git switch branch and remote branch and commit

1. Create a new branch locally

repo start --all work1 (all works)

repo start work1 current git repository

git checkout work1 switches to the new branch work

Connect an existing local branch to a remote branch

git branch --set-upstream-to=origin/master (remote branch name) work1 (local branch name)



2. Create a new branch and connect to another remote branch


1. git branch --all View all local branches


2. git remote show aosp -- view the relationship between the local branch and the remote branch


3. Create a local "new branch" and directly track the "remote another" branch code line

 git branch work1 (new branch name) --track remotes/aosp/xxxxxxxctaMP (This will fill in all the remote analysis seen by git branch --all above, and fill in those you want to track)


4. git remote show aosp -- view the relationship between the local branch and the remote branch


5. git checkout work1 switches to work1 for operation


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325921394&siteId=291194637