git使用总结
git关闭filemode
从Mac切换到Windows后,发现git有些文件是modified
状态:
❯ git status
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: packages/src/pages/index.js
尝试将文件还原:
❯ git checkout packages/src/pages/index.js
Updated 1 path from the index
❯ git status
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: packages/src/pages/index.js
发现还原后还是显示modified
,查看文件变化:
❯ git diff packages/src/pages/index.js
diff --git a/packages/src/pages/index.js b/packages/src/pages/index.js
old mode 100755
new mode 100644
发现文件的内容并没有变而是mode变了,关闭filemode:
git config core.filemode false
关闭后再 git status
就恢复正常了。
使用代理
访问 github的速度不稳定,可以使用sockets代理:
git config --global http.proxy 'socks5://{ip}:1080'
git config --global https.proxy 'socks5://{ip}:1080'