ubuntu使用github

1. git init

初始化一个空的git仓库。

2. A Git project can be thought of as having three parts:

  1. Working Directory: where you'll be doing all the work: creating, editing, deleting and organizing files
  2. Staging Area: where you'll list changes you make to the working directory
  3. Repository: where Git permanently stores those changes as different versions of the project

3.git status

As you write the screenplay, you will be changing the contents of the working directory. You can check the status of those changes with: git status


红色表示还没有开始跟踪红色的文件。因为红色的这个文件还没有commit,所以可以看到却无法跟踪。


4.git add scene-1.txt

add表示从第一状态到第二状态。
commit表示从第二状态到第三状态。



5.git diff scene-1.txt

有时候不加文件名也是可以的。



6.git commit -m "modify something"



7.git log



8.git show HEAD

最新一次commit内容:




9.git checkout HEAD scene-5.txt

先更改了scen-5.txt ,然后git diff,然后git checkout HEAD scene-5.txt,恢复原状。(commit过也可以的呢)


10.git reset HEAD scene-2.txt

这里你改了scene-2.txt,同时把它add到了staging area状态,同时在staging area状态的还有scene-3.txt和scene-7.txt,这时你想要返回scene-2.txt文件,所以可以用上面的这条语句,然后你再git commit的时候就会出现下图的情况:



11.get reset SHA





12. git branch




13. git branch xiaoxiao



14. get checkout xiaoxiao



15. git merge master

注意合并方向啊! 
git  merge  fencing的含义是将fencing合并到master中。

当产生冲突的时候,去修改文件,然后再add,commit。

16. git branch -d xiaoxiao




17. git clone science-quizzes my-quizzes




18. git remote -v

我们克隆了远程的仓库,git后台会给这个仓库地址命名为origin,来方便使用。



19. git fetch

查看远程是否有更改并更新!!!


20. git merge origin/master

在上一步中,fetch下来的更新你还不能更改,因为还没有在你的master上更新,所以用这个merge语句就可以了呢。



21. git push origin xiaoxiao

将本地分支上传!居然没讲pull。



总结!!!!







1.  到git目录下:

git pull git@xxxxx

2. 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值