git常用操作

Suppose we have three user account: gituser, juan and jerry
gituser is used for git remote repository
juan is used for dev1
jerry is used for dev2
(Note: all these three users all sit in the same machine named driver because of the shortage of machine)

Let’s see how git common commands work

1 create git remote repository
在这里插入图片描述
OK. An empty remote repository has been created.

2 juan(dev) clone remote repository
在这里插入图片描述
Juan sucessfully downloaded the remote repository which is empty. In order to clone conveniently, I have configured password-less access for user ‘juan’. See reference at the end of this article to see how to configure password-less access.
In the picture above, I used ip ‘127.0.0.1’ in clone command since gituser which is the user of our remote repository sits on the same machine with user ‘juan’ and ‘jerry’. You can change ip to be the one your gituser will use in your case

3 create a master branch and commit some code by ‘juan’
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
origin is the default name of our remote repository
Here we use command ‘git push origin master’ to push exisitig code to remote branch(master) on remote repository

4 create a new branch based on master branch. Make some changes on new branch and summit the changes to the new remote branch

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
5 jerry clones code and switched to new_branch. juan updated branch new_branch. jerry then updated her code to be latest on new_branch

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
Here you can use pull instead of the combination of fetch and merge

reference: password-less access
(take juan as an example)
1 generate public key for juan
在这里插入图片描述
2 copy juan’s public key to gituser
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值