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
  4. ubuntu使用github_第1张图片

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

ubuntu使用github_第2张图片

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


4.git add scene-1.txt

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

ubuntu使用github_第3张图片


5.git diff scene-1.txt

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

ubuntu使用github_第4张图片


6.git commit -m "modify something"

ubuntu使用github_第5张图片


7.git log

ubuntu使用github_第6张图片


8.git show HEAD

最新一次commit内容:

ubuntu使用github_第7张图片

ubuntu使用github_第8张图片


9.git checkout HEAD scene-5.txt

先更改了scen-5.txt ,然后git diff,然后git checkout HEAD scene-5.txt,恢复原状。(commit过也可以的呢)
ubuntu使用github_第9张图片

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的时候就会出现下图的情况:

ubuntu使用github_第10张图片


11.get reset SHA

ubuntu使用github_第11张图片
ubuntu使用github_第12张图片
ubuntu使用github_第13张图片

12. git branch

ubuntu使用github_第14张图片
ubuntu使用github_第15张图片

13. git branch xiaoxiao

ubuntu使用github_第16张图片

14. get checkout xiaoxiao

ubuntu使用github_第17张图片

15. git merge master

注意合并方向啊! 
git  merge  fencing的含义是将fencing合并到master中。
ubuntu使用github_第18张图片
当产生冲突的时候,去修改文件,然后再add,commit。
ubuntu使用github_第19张图片 ubuntu使用github_第20张图片

16. git branch -d xiaoxiao

ubuntu使用github_第21张图片


17. git clone science-quizzes my-quizzes


ubuntu使用github_第22张图片

18. git remote -v

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

ubuntu使用github_第24张图片


19. git fetch

查看远程是否有更改并更新!!!
ubuntu使用github_第25张图片


20. git merge origin/master

在上一步中,fetch下来的更新你还不能更改,因为还没有在你的master上更新,所以用这个merge语句就可以了呢。
ubuntu使用github_第26张图片
ubuntu使用github_第27张图片

21. git push origin xiaoxiao

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



总结!!!!

ubuntu使用github_第28张图片

ubuntu使用github_第29张图片

ubuntu使用github_第30张图片

ubuntu使用github_第31张图片



1.  到git目录下:

git pull git@xxxxx

2. 

你可能感兴趣的:(bikesharing)