1. git init
初始化一个空的git仓库。
2. A Git project can be thought of as having three parts:
- A Working Directory: where you'll be doing all the work: creating, editing, deleting and organizing files
- A Staging Area: where you'll list changes you make to the working directory
- A 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.