惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Lynx

Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方 Lynx | 小熊写字的地方
Lynx | 小熊写字的地方
2019-03-12 · via Lynx

合并远程分支

  1. git fetch origin branch
  2. git checkout [your-branch]
  3. git merge FETCH_HEAD,merge 前可以先git dff [your-branch] [remote-branch],查看本地分支和远程分支的区别

使用 rebase 合并分支

  1. git rebase [origin-branch]
  2. 遇到冲突,解决完冲突后 git add
  3. git rebase –continue

rebase 和 merge 的区别

合并历史commit

git rebase -i [commit id] commit id是合并的提交的前一个提交节点的commitID,最上的是最早的提交
修改需要合并的commit,将pick修改成 squash
退出保存 wq
git push origin [branch-name] -f
rebase 的主要用途一是替代merge,保持分支历史的线性提交;二是方便合并历史提交。

撤销一次merge

  1. git reflog 确定回滚的commit id
  2. git reset –hard [commit id]

git revert 也可以回退到指定版本,和reset的区别在于,revert会产生一次新的提交,用一次新的提交来消除历史修改。而reset是直接删除历史commit。

合并时遇到冲突,想取消merge

git merge –abort

修改最后一次提交的commit message

git commit –amend

清空工作区的修改

git checkout .

恢复误删分支

  1. git log -g 找到之前分支提交的 commit id
  2. git branch recover_branch [commit id],这时切换到 recover_branch,可以看到原来的文件了。

修改历史提交信息

  1. git rebase -i HEAD~10(查看前10次提交信息,也可以直接输入想要修改的commit id)
  2. 将想要的修改的commit前的 pick 修改为 reword,保存并退出。
  3. 在弹出的窗口中,修改commit message,保存。

删除历史提交

  1. 用 git rebase -i 928582641a 指定 base 为你需要删除的提交的前一个提交。
  2. 删除指定的commit, 保存退出. 之后可能 git 会提示出现 conflict, 根据提示完成处理。

创建空白分支

  1. git checkout –orphan new_branch
  2. git rm -rf .

查看本地分支和远程分支的差异

  1. git fetch origin
  2. git diff master origin/master –minimal

建立远程追踪分支

git branch -u [remote_branch]

删除远程分支

  1. git branch -r -d origin/branch-name
  2. git push origin :branch-name