生而为人

程序员的自我修养

0%

[3/24 10:17] Bolun YaoNew Bing又增加了什么神奇的监测机制,现在挂私人梯子完全上不去了
今天之前还没什么问题,现在会被疯狂redirect到“国内版”,即便偶尔打开 chat 一次也会报错 looks like your network settings are preventing access to this feature.
全局也没用了,这怎么检测到的

[3/24 10:50] Ray Sun
清 cookie,或者 ?mkt=en-US ?
​[3/24 10:51] Ailing Ji
我倒是不会,你是关闭过浏览器吗,设置一下url参数:setlang=en&cc=us
<https://teams.microsoft.com/l/message/19:9268e0678e654fc1a8965e739a1859ec@thread.skype/1679626207358?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=2e06e852-2e42-4acb-a366-5df01ee87a68&parentMessageId=1679624261164&teamName=Suzhou Life&channelName=General&createdTime=1679626207358&allowXTenantAccess=false>
关闭浏览器试过了,清cookie 和 mkt 还没试。不过有个更根本的问题是即便想办法打开 chat 也会报错 looks like your network settings are preventing access to this feature.
貌似最近有些 IDC 的 IP 段也被 new bing ban 了,可以在梯子上套一层 cloudflare warp

推荐chatgpt。用公司的 150刀 azure credit,把chatgpt 和 speech recognition, text to speech 连起来,就是一个超棒的英语口语陪练了

规则引擎:

easyRule

[toc]

标准流程

  1. 添加暂存区git add .()

分支

克隆

1
2
3
4
5
git checkout -b dev(本地分支名称) origin/develop(远程分支名称)

error log:
fatal: 'origin/MTSparkMSNv2' is not a commit and a branch 'users/jingqicao/M2B_V2' cannot be created from it
need run git pull to update.

删除

Git 操作——如何删除本地分支和远程分支

新分支push到远端

1
2
3
git push --set-upstream origin users/jingqicao/performance-optimize
// 需要保证本地分支名称与指定的remote分支名称完全相同,否则
error: src refspec users/jingqicao/performance-optimize does not match any

本地关联远程分支

1
2
3
4
1. push同时关联
git push --set-upstream origin xxx
2. 关联已经存在的
git branch --set-upstream-to=origin/dev

本地切换远程已有分支

1
2
3
4
5
6
7
8
9
10
11
12
13
14
```





## 内容

### 撤销修改

```bash
// 这是一个危险的操作,会撤销指定文件或全部文件的所有本地修改
git checkout -- <file>
git checkout -- .

提交(commit)

1
2
3
4
5
6
7
git commit -m ""

git commit -am ""
追加commit注释,一次push不会生成多个commit节点

git commit --amend
可以修改最近一次commit的注释

查看当前commit

1
git log

对比两个commit(两个commit可以来自不同分支)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
hash2 在 hash1上的修改
git diff commit-hash1 commit-hash2 --stat

如果想进一步查看test修改了那些地方:
只需将 git diff hash1 hash2 --stat 中的 --stat改为具体的文件即可

如果想将两次提交的差异部分提取成补丁文件
git diff hash1 hash2 filename > patch_name

如果想将多个文件的差异生成到同一patch文件 则:
git diff hash1 hash2 filename1 filename2 > patch_name

使用工具(左右两个commit,对应了difftool的左右窗口):
git difftool 199b8598f422485e453f1e4e87aaa6176ff48ad0 4b97457217e29355ddeff0aec8562271c06ac6fe --stat

对比两个分支

1
2
3
4
git diff users/jingqicao/temp-master master --name-status
可以展示变更文件的全路径

git diff-tree
  1. Git 修改已提交的commit注释

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for github.com has changed,
and the key for the corresponding IP address 20.205.243.166
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.
Add correct host key in /Users/cjq/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/cjq/.ssh/known_hosts:10
RSA host key for github.com has changed and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
1
2
3
>> ssh-keygen -R github.com			//更新know_hosts中的内容
>> 更新publickey(参考)
>> ssh -T git@github.com // 测试是否能正确连接

Reference:

  1. https://blog.csdn.net/helloasimo/article/details/123778112

编辑

删除工作区某个文件,或某个目录的改动

1
2
git checkout <file-name>
git checkout <path-name>

查看

#如何使用git比较两次commit之间的差异文件

1
2
3
git diff hash1 hash2
hash2是后提交的commit
即hash1是被对比commit,diff结果是hash2在hash1上的改动

查看本地分支关联的远端分支

1
git branch -vv

简化命令

git 添加别名的方式,打开~/.gitconfig文件在其末尾添加:
在命令行输入以下命令:
1、进到根目录
cd ~/
2、打开.gitconfig,
vi ~/.gitconfig

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
a = add
b = branch
c = commit
d = diff
l = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset | %C(bold)%an' --abbrev-commit --date=relative
r = reset
aa = add .
ba = branch -a
ca = commit -a
cc = commit -a -m
cl = clone
cm = commit -m
co = checkout
cp = cherry-pick
nb = checkout -b
pl = pull
ps = push origin master
st = status

[diff]
tool = default-difftool
[difftool "default-difftool"]
cmd = code --wait --diff $LOCAL $REMOTE
[difftool]
prompt = false

git st 和 git status 等同效果
3、修改完后保存退出就可以了

杂项

关闭difftool的使用询问:

1
2
3
4
5
询问:
Launch 'default-difftool' [Y/n]

关闭:
git config --global difftool.prompt false