git使用

2017-11-20  本文已影响0人  Jason_lai

Mac生成密钥

~/.ssh/id_rsa.pub

cat ~/.ssh/id_rsa.pub

全局配置git账号

git config --global user.name "Your Name"
git config --global user.email your@example.com

开始使用

1.初始化

git init

2.提交

git add -A

3.查看状态

git status

4.提交暂存

git commit -m "说明"

5.查看历史记录

git log

6.创建分支

git checkout master
git checkout -b "分支名"

7.合并分支

git checkout master
git merge 分支名

8.推送

git push

9.如果不小心删除文件,可以使用以下命令进行恢复

git checkout -f

10.还原修改文件到原始状态

git checkout .
git clean -f -d

上一篇下一篇

猜你喜欢

热点阅读