Git

1.如何在Github Pages搭建自己写的页面?

  https://www.cnblogs.com/lijiayi/p/githubpages.html

2.解决 github push failed (remote: Permission to userA/repo.git denied to userB.)

  https://blog.csdn.net/klxh2009/article/details/76019742

3.git命令总结:

git log

git status

git add .

git commit -m ‘中文文字’

git push -u origin 分支名

https://www.jianshu.com/p/ac74b8eb3296 

https://www.jianshu.com/p/50ebd73b08aa

4.如何将远程代码更新到本地?

git fetch:相当于是从远程获取最新版本到本地,但不会自动 merge。具体操作如下:

git fetch origin master

git log -p master origin/master

git merge origin/master

首先从远程的 origin 的 master 主分支下载最新的版本到 origin/master 分支上;

然后比较本地的 master 分支和 origin/master 分支的差别;

最后进行合并;

git log 输入q退出

git pull:相当于是从远程获取最新版本并 merge 到本地 。具体操作如下:

git pull origin master

上述命令其实相当于 git fetch + git merge,

在实际使用中,git fetch 更安全一些,因为在 merge 前,我们可以查看更新情况,然后再决定是否合并。

https://www.cnblogs.com/52php/p/6635875.html

https://www.ruanyifeng.com/blog/2014/06/git_remote.html

5.Code Review

git push origin HEAD:refs/for/dev/20200323 


每次push提交代码前,使用git pull --rebase同步最新的代码

git stash  可用来暂存当前正在进行的工作

git pull --rebase

git stash pop 从Git栈中读取最近一次保存的内容

本地解决冲突

git add .

git commit -m '变更文字'

git push origin HEAD:refs/for/dev_20200309


a.把你 commit 到本地仓库的内容,取出来放到暂存区(stash)(这时你的工作区是干净的)

b.然后从远端拉取代码到本地,由于工作区是干净的,所以不会有冲突

c.从暂存区把你之前提交的内容取出来,跟拉下来的代码合并

所以 rebase 在拉代码前要确保你本地工作区是干净的,如果你本地修改的内容没完全 commit 或者 stash,就会 rebase 失败。

参考:https://blog.csdn.net/u011240877/article/details/52668807

相关系列文章:

https://blog.51cto.com/qiangsh/1769956

https://liqiang.io/post/git-confliction-solution

https://git-scm.com/book/zh/v2

你可能感兴趣的:(Git)