Git:推送到新的远程地址;更改本地和远程分支的名称

Git global setup(全局设置)

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

Create a new repository(创建一个新仓库)

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(存在的本地工程,推送到新的远程地址)

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(存在的工程,推送到新的远程地址)

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-更改本地和远程分支的名称

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: 常用命令 https://blog.csdn.net/fly910905/article/details/79166272

Idea:Git的常用菜单操作和常用命令【含分支创建、检出、提交、合并】 https://blog.csdn.net/fly910905/article/details/79501896

猜你喜欢

转载自blog.csdn.net/fly910905/article/details/91821452