GIT 经验合集
GITIGNORE
代码库根目录没有添加 .gitignore
文件,但某些文件,如: a.dll
仍被忽略。原因在于“全局忽略文件”,通过如下命令查看:
git config --global core.excludesfile
REBASE 、 CHERRY-PICK 、 REVERT 与 MERGE
rebase
、 cherry-pick
和 revert
除了 --abort
选项外,都有 --continue
选项,而 merge
只有 --abort
选项,没有 --continue
选项。
列出 index 上的文件
git ls-files
Show information about files in the index and the working tree.
git ls-files --stage
在某个提交的树上按文件名查找文件
git ls-tree
List the contents of a tree object.
git ls-tree -r <tree-ish> --name-only | grep <file_name>
分支默认的 remote
当执行 git push
时,默认为当前分支,当前分支对应的 remote
通过如下命令查看和设置:
# 查看
git config branch.<branch_name>.remote
# 设置
git config branch.<branch_name>.remote <remote_name>
# 查看 remote 列表
git remote show