GIT 经验合集

GIT 经验合集

GITIGNORE

代码库根目录没有添加 .gitignore 文件,但某些文件,如: a.dll 仍被忽略。原因在于“全局忽略文件”,通过如下命令查看:

git config --global core.excludesfile

REBASE 、 CHERRY-PICK 、 REVERT 与 MERGE

rebasecherry-pickrevert 除了 --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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值