git - 实时更新

0&&1=0 / 2024-10-09 / 原文

配置

[alias]
	lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
	br = branch
	co = checkout
    cp = cherry-pick
	pl = pull
	ps = push
	sa = stash
	sp = stash pop
	ft = fetch
	mom = merge origin/master
	rh1 = reset --hard HEAD~1
	rom = rebase origin/master
 
git commit --amend
git reset --hard 7e052815e3325b72cd7ffd3390e15c0cc9d0a76
git reset --hard HEAD~3  第n次
 
git修改之前某一个特定的commit : 假如之前的某个提交的上一笔commit id是:928fc8a3686bf5fcf4527873e075703a9998c127     https://www.jianshu.com/p/96ed16586a86
    git log #查看commit id 找到上一笔commit id
    git rebase 928fc8a3686bf5fcf4527873e075703a9998c127 --interactive
    然后在vi中修改pick为edit,wq保存退出,接着进行内容修改,git add后git commit --amend
    最后git rebase --continue即可再次回到最新的头部
 
回滚指定tag版本到当前分支 
  找到tag的最新commit  fb479960c0cec5549463ae123d70bdd72ccf6be7
  git reset --hard fb479960c0cec5549463ae123d70bdd72ccf6be7
 
远程分支强制覆盖本地分支  
  git pull --force  <远程主机名> <远程分支名>:<本地分支名>
 
远程分支列表
  git branch -r
创建并切换到新分支
  git switch -c <new-branch-name>
创建并切换到远程分支
  git checkout -b 本地分支名x origin/远程分支名x
 
 
git clone --depth 1 <地址>
git fetch --unshallow
 
 
 
当前代理信息: 
PowerShell:    Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
 
打开当前目录:
    explorer .