相关技巧
主页 > 网络编程 > 相关技巧 >

Git多人协同开发紧急修复线上bug操作指南

2022-06-25 | 酷站 | 点击:

使用场景

解决思路

操作流程

1

2

git checkout master

git pull

1

git branch master_hotfix

1

git checkout master_hotfix

1

coding

1

2

git checkout dev

git merge master_hotfix

1

git push origin dev

1

2

git checkout master

git merge master_hotfix

1

git push origin master

1

git tag -a 1.1.0 -m "紧急修复xxbug"

1

git push --tag

1

git branch -d master_hotfix

1

git checkout dev

附录:Git使用的小技巧

Git命令别名

1

vim ~/.gitconfig

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

[alias]

br = branch

ci = commit

cl = clone

co = checkout

cp = cherry-pick

cfg = clone

df = diff

fh = fetch

lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"

mg = merge

pl = pull

plr = pull --rebase

rb = rebase

ph = push

rmt = remote

rst = reset

sh = stash

st = status

sts = status -s

sbm = submodule

sw = show

swf = "show --name-status"

delb = "push origin --delete"

delt = "push origin :"

mb = merge-base

比如:

1

git commit -m'注释'

可以简化为:

1

git ci -m'注释'

总结

团队协作是职业生涯中必须面对的问题,Git为我们代码的协作管理提供了强大的工具。 熟悉Git操作,拥抱团队协作。

原文链接:https://juejin.cn/post/7018771333173477383
相关文章
最新更新