Git: pushed to new remote address; change the name of the local and remote branch

Git global setup (global settings)

git config --global user.name "wangyf"
git config --global user.email "[email protected]"

Create a new repository (create a new warehouse)

git clone http://192.168.3.11/wangyf/XXX.git
cd sdk-cms
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Existing folder (local engineering presence, pushed to a new remote address)

cd existing_folder
git init
git remote add origin http://192.168.3.71/wangyf/sdk-cms.git
git add .
git commit -m "Initial commit"
git push -u origin master

Existing Git repository (existing project, pushed to a new remote address)

cd existing_repo
git remote rename origin old-origin
git remote add origin http://192.168.3.71/wangyf/sdk-XXX.git
git push -u origin --all
git push -u origin --tags

git- change the name of the local and remote branch

git branch -m old_branch new_branch # Rename branch locally 
git push origin :old_branch # Delete the old branch 
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote

Git: commonly used commands  https://blog.csdn.net/fly910905/article/details/79166272

Idea: Git common menu operation and common commands [with branches create, check out, commit, merge]  https://blog.csdn.net/fly910905/article/details/79501896

Guess you like

Origin blog.csdn.net/fly910905/article/details/91821452