Git tips: The local repo already exists, the corresponding remote repo is tiger, and the local branch is master.
Question 1:
When the remote repo repository for pulling code is tiger, what should I do if I want to push the changes to the develop branch of the remote Repo? Idea: Pull the new remote_develop_repo_url, merge the original code into the current branch, and then submit it to remote_develop_repo_url ,.
- First, submit the current modification to the local current master branch, git commit-M "this is comment"
- Use git remote add remote_repo_name URL to add a new remote repo and git remote add new_repo url_from_igerrit.
- Then, use git fetch remote_repo_name to pull the code, git branch, and its configuration locally. Git fetch new_repo
- Then, switch git checkout-B xx local_url to the new branch, and git checkout-B develop new_repo/develop
- Then merge the modifications to the master branch to the current branch. The merge command automatically commit the Merged Code to the new branch, git merge master
- Then, use git log to check whether the update generates a change-id. Otherwise, copy commit-MSG to the current directory. git log in the GIT/hook directory (only for the CI server to identify the Id submitted based on the change-ID)
- Finally, use git push remote_repo_name local_branch_name:/refs/For/remote_repo/branch_name. Git push new_repo develop: refs/to/remote_develop_branch
Question 2:
Git usage tips (continuously updated)