[git]git 分支

时间:2022-01-23 16:12:20

什么动作,关键看你想完成什么

1. 添加新的远程分支:

git push origin current_local_branch:new_remote_branch

2. 删除远程分支(冒号前必须要有空格)

git push origin :remote_branch

3. 切换到远程分支(只作临时)

git checkout remotes/origin/new_remote_branch

4. clone远程某个分支

git clone -b new_remote_branch https://github.com/***/***.github.git

5. 新建repo

  • 首先在github上新建一个repo
  • 然后github也有提示
    echo "# repo_test" >> README.md
    git init
    git add README.md
    git commit -m "first commit"
    git remote add origin https://github.com/aaronRong/repo_test.git
    git push -u origin master
  • git branch -a 可以看到本地出现了remotes/origin/master分支