您的位置:首页 > 其它

git常用命令总结

2015-12-18 19:44 399 查看
1.初始化工程

#mkdir git-project
#cd git-project
#git init --bare
2.clone和提交代码
#git clone
***克隆git***
#cd RSA
#ll
total 4
-rw-r--r-- 1 root root 3 Dec 18 15:43 README.md
#git add test.txt
#git commit -am "add test.txt"  ***提交到仓库,并添加注释信息***
[master d2d81f3] add test.txt
3 files changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 test2.txt
delete mode 100644 test3.txt
delete mode 100644 "\346\226\260\345\273\272 \345\245\275\345\216\213 ZIP \345\216\213\347\274\251\346\226\207\344\273\266.zip"
$git push                  #push到服务器
$git pull                  #更新
remote: Counting objects: 2, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (2/2), done.
From http://10.240.210.40/git/jyops/RSA af57d29..f4d3bd6  master     -> origin/master
Merge made by the 'recursive' strategy.
temp.txt | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 temp.txt
$git log |more               #查看log日志
commit adeedf2aa48ea72d210fbc91a1f664319d0aaadb
Merge: d2d81f3 f4d3bd6
Author: test <test@jiayuan.com>
Date:   Fri Dec 18 19:38:00 2015 +0800

Merge branch 'master' of http://10.240.210.40/git/jyops/RSA 
commit d2d81f34b6a3f86ad5699e614d6f7625f5011320
Author: test <test@jiayuan.com>
Date:   Fri Dec 18 19:09:58 2015 +0800

add test.txt

commit f4d3bd6d5ae65337490d9a0d7e243c8d90ffbe73
Author: test <test@jiayuan.com>
Date:   Fri Dec 18 16:08:29 2015 +0800
3.git clone时携带用户名密码
https://username:password@github.com/username/repository.git
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: