2019独角兽企业重金招聘Python工程师标准>>>
当我们在正常开发过程中,经常会插进来一些bug修改,为了不影响在写的代码,需要新开一个分支作为bug修复。
clone一份最新代码到本地
git clone https://code.xxx
查看remote
git remote -v
- origin https://code.xxx
查看分支
git branch
- master
创建分支并拉取远程指定分支
当我想从远程仓库里拉取一条本地不存在的分支时:
git checkout -b 本地分支名 origin/远程分支名
这个将会自动创建一个新的本地分支,并与指定的远程分支关联起来。
新建分支&切换分支
git branch yml2.0
git checkout yml2.0
or
git checkout -b yml2.0
- Switched to branch 'yml2.0'
修改文件
将原来:
profiles:
active: test
修改为:
profiles:
active: prod
查看修改状态
git status
- modified: src/main/resources/application.yml
提交修改
git add .
git commit -m 'yml2.0'
git push origin yml2.0
推送成功,同时在远程创建yml2.0分支
数据修改成功