git查看修改指令

2019-10-24  本文已影响0人  黎希

查看当前用户名称和邮箱地址

git config --global user.email
git config --global user.name 

修改git提交名称和邮箱地址

git config --global user.email "xxx@gmail.com"
git config --global user.name "xxx"

设置ssh

ssh-keygen -t rsa -C "youremail@example.com"

回车敲三下

进入ssh文件

cd ~/.ssh

查看ssh

cat ~/.ssh/id_rsa.pub

克隆

git clone #远程仓库地址#

添加

git add .

提交本地

git commit -m"#所提交版本描述#"

推送

git push

强制推送

git push origin HEAD --force

拉取

git pull

版本查看

git log

版本回滚

回退到上个版本

git reset --hard HEAD^        

回退到前3次提交之前,以此类推,回退到n次提交之前

git reset --hard HEAD~3

退到/进到 指定commit的sha码

 git reset --hard commit #id#
上一篇下一篇

猜你喜欢

热点阅读