Skip to content

prowerInJava/git-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

git-commands

常用的GIT版本管理工具的命令

尚未完成多人协作开发的操作流程的学习

splinter

splinter-master是整合了selenium的框架

安装方法

解压压缩包,进到文件夹运行python3 setup.py install

安装了git的电脑可以运行git clone git://github.com/cobrateam/splinter.git

cd splinter

python3 setup.py install

Git 忽略本地文件的更改,不影响仓库上的该文件内容:

在 Git 中,让 Git 不再检测该文件的变化(即使你在本地修改了它),但不影响仓库中该文件的内容,可以使用以下命令:

git update-index --assume-unchanged <file-path>

示例:

git update-index --assume-unchanged config/local.conf

这个命令会告诉 Git:“假设这个文件没有变化”,即使它实际上被修改了。


如果你想恢复跟踪这个文件的变化,可以使用:

git update-index --no-assume-unchanged <file-path>

说明:

  • 这个操作不会改变远程仓库内容,也不会提交任何更改。
  • 它只是在你的本地索引中标记该文件为“未更改”。
  • 常用于避免不小心提交一些配置文件或环境相关文件的本地改动。

注意事项:

  • --assume-unchanged 是一种优化机制,原本是用于提升性能(比如告诉 Git 某些文件不会变,不用频繁检查)。
  • Git 仍然可能在某些情况下重新检测到更改(例如切换分支、重新初始化索引等),如果需要更稳定的忽略方式,可以用 --skip-worktree

补充:--skip-worktree 的用法

有时候你希望 Git 完全忽略本地更改,甚至当你执行 git checkoutgit merge 时也不覆盖本地文件,这时可以使用:

git update-index --skip-worktree <file-path>

恢复跟踪:

git update-index --no-skip-worktree <file-path>

区别总结:

选项 含义
--assume-unchanged 假设文件未改变(适用于临时忽略改动)
--skip-worktree 工作树中的文件跳过更新(适合长期忽略本地修改)

你可以根据实际需求选择使用哪一个。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published