git初始化本地仓库: git init
将本地代码提交到本地仓库中
git add *
git commit -m '提交内容的描述'
将本地仓库与远程仓库进行绑定,并且push
git remote add origin 你的远程仓库的URL
//例如
git remote add origin https://github.com/gujunling/test.git
//将代码提交到github上
git push origin master
git reflog
查看你本地提交记录
git reset --hard HEAD@{2}
回退到本地最新代码的位置
git stash list
读取Git栈内的所有备份
git stash clear
清空Git栈
push to origin/master was rejected错误解决方案
git pull
git pull origin master
git pull origin master --allow-unrelated-histories
初始化git
git config --global user.name "你的用户名"
git config --global user.email "你的邮箱"
创建ssh密匙
ssh-keygen -t rsa -C "你的邮箱"
$ ssh-keygen -t rsa -C "Aaron.H.Shen@xxx.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/hongtao.shen/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/hongtao.shen/.ssh/id_rsa
Your public key has been saved in /c/Users/hongtao.shen/.ssh/id_rsa.pub
The key fingerprint is:
合并主分支
git stash
备份当前工作区的内容
git pull
下载git仓库的代码同步到本地
git stash pop
读取最近一次保存的内容,恢复工作区
网友评论