Git and GitHub

Git

 

Head mean current commits

 

Git init 在将当前路径的文件夹创建为repository

 

Git log 查看commitsid

 

git add 增加文件到stagingarea

 

git status 查看stagingarea的情况(文件)

 

git commit 将stagingarea中的文件提交到repository

 

git checkout 回滚到commitId的版本,并创造出该ID的分支(但是MASTER没有影响)

git checkout branchname :  branch由master切换到名字为branchname的branch

git checkout –b newbranchname:  创建一个新的branch withname,并切换到新建的branch

 

git reset commit id 回滚到commit Id的版本(当在master执行时,master就会返回该commitID的版本,不会创建新版本)

 

git show commit1 比较commit1和它父类的commit的差别,我们并不需要明确找出commit2的ID

 

git diff commit1 commit2 比较commit1 commit2两个ID的差别

git diff –staged 比较repository和staging area的差别

git diff 比较working directory和staging area的差别

 

git branch no argument 查看全部的branch,并用星号*标记当前处在的branch

git branch newbranchname 创建一个新的branch with name

git branch –d branchname:  删除branch

 

git merge branch1 branch2 把branch2并入branch1(如果有冲突需要手动接触冲突然后在此合并)

 

solove conflict

 

GitHub

 

git remote 查看当前全部的remote

git remote add origin https:// 创建远程remote关联到GitHub上的repository并标记为origin

 

git push argument1 argument2 参数1代表我想挂载到的远程remote,参数2是我想将哪一个当地branch挂载到GitHub上

git pull argument1 argument2 参数1代表我想同步的远程remote到本地local,参数2是我想让哪一个当地branch同步于GitHub(pull takes a branch from a remote and brings it to your localrepository,push does the opposite,taking a branch and pusing it to remote)

 

 

Fork is a lot like cloning ,在GitHub上复制别人的repository到你自己的GitHub账户中。

 

Collaborators 在GitHub中赋予这些用户修改(push)你当前repository的权限

 

Fetching updates origin/master with the contentsof GitHub’s master branch, and then origin/master is merged into master ,so gitpull is as same as git fetch followed by git merge

 

Fast-forward merge : you can reach a fromb, so you can do a fast-forward merge.

 

Pull requests :

 

Git is local,GitHubis where we shares and collaborate with other people

 

Remote name (1)origin: a remote that pointsto the original repository on your repository GitHub.

(2)upstream: a remote that points to theoriginal repository you forked (from other people )on GitHub.

 

Q:如何看BASH里的帮助提示?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值