TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How core Git developers configure Git

317 点作者 chmaynard3 个月前

13 条评论

juped3 个月前
Wow, never autopush all your tags. What a terrible idea! Once a tag escapes into the wild, it&#x27;s so hard to ever get rid of it. Pushing a tag should require two people turning keys simultaneously or something, honestly.<p>zdiff3 is also NOT some kind of generic improvement over diff3, like swapping diff algorithms is sorta a generic improvement. It behaves very differently; if you have<p><pre><code> [original] this is a line [left branch] This is a line. This is a second line. [right branch] This is a line. This is another line. </code></pre> then diff3 shows<p><pre><code> &lt;&lt;&lt;&lt;&lt;&lt;&lt; This is a line. This is a second line. ||||||| this is a line ======= This is a line. This is another line. &gt;&gt;&gt;&gt;&gt;&gt;&gt; </code></pre> while zdiff3 modifies this in a <i>very</i> matter-of-personal-taste way to:<p><pre><code> This is a line. &lt;&lt;&lt;&lt;&lt;&lt;&lt; This is a second line. ||||||| this is a line ======= This is another line. &gt;&gt;&gt;&gt;&gt;&gt;&gt; </code></pre> This is incredibly bizarre to my eye, but some prefer how it&#x27;s already &quot;partially resolved&quot; for them. But it&#x27;s hardly something to swap in thoughtlessly for the other!
评论 #43179451 未加载
评论 #43179193 未加载
videlov3 个月前
&gt; excludesfile = ~&#x2F;.gitignore<p>It has happened to me in the past to wonder why certain files&#x2F;folders are ignored by git, only to realise that I had a global git ignore for the particular pattern.<p>Not sure l’d recommend this as a good default, but perhaps others have better memory than I do.
评论 #43178317 未加载
评论 #43177835 未加载
评论 #43178696 未加载
评论 #43177713 未加载
评论 #43177732 未加载
评论 #43178609 未加载
评论 #43178985 未加载
评论 #43177485 未加载
larusso3 个月前
Good stuff here. But I don‘t like the auto pruning suggestion as a reasonable global default. Or at least this shows that users who really see this as useful see no real difference between git and let’s say SVN. The whole idea is that the system is distributed and that you don‘t follow blind another upstream. But I grant the fact that most projects are not developed like the Linux kernel for which git was created. But there is another issue. I personally like the fact that I keep a history of old branches etc. This can also save me if I or another person in the team deletes a branch by accident. I assume that pruning would maybe not delete the objects right away. Need to check that.<p>What would actually happen if I have a branch under development and it gets deleted from remote? Will it remove locally for me then? I guess only when my local head is equal to what remote pointed to.
评论 #43178600 未加载
评论 #43179526 未加载
评论 #43179465 未加载
评论 #43178615 未加载
evmar3 个月前
My favorite &quot;took me a long time to discover&quot; Git tweak is to use difft for diffs:<p><a href="https:&#x2F;&#x2F;difftastic.wilfred.me.uk&#x2F;" rel="nofollow">https:&#x2F;&#x2F;difftastic.wilfred.me.uk&#x2F;</a>
评论 #43179270 未加载
评论 #43179233 未加载
do_not_redeem3 个月前
dupe of <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=43169435">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=43169435</a>
mattmanser3 个月前
This was posted already earlier today, lots of comments on the other thread:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=43169435">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=43169435</a>
kibwen3 个月前
The irony here being that GitButler is a GUI for git, whereas most of these config values are for the benefit of the CLI. :P<p>Since they&#x27;re being too polite to shill themselves, I&#x27;ll tempt HN by mentioning that GitButler is open-source and will soon be switching its underlying git support from libgit2 to gitoxide (a rewrite of libgit2 in Rust).
评论 #43179165 未加载
yyyk3 个月前
It would be nice to have a way to auto-fastforward other branches when pulling and you have no commits in those branches (There are scripts for that, but it should be in git).<p>Another nice thing would be a way to exclude file specs in git diff (Hack: add &#x27;true&#x27; as a diff program in .git&#x2F;config and use .gitattributes to exclude by setting diff=true).
评论 #43179537 未加载
westurner3 个月前
skwp&#x2F;git-workflows-book &gt; .gitconfig appendix: <a href="https:&#x2F;&#x2F;github.com&#x2F;skwp&#x2F;git-workflows-book?tab=readme-ov-file#appendix-a---the-gitconfig">https:&#x2F;&#x2F;github.com&#x2F;skwp&#x2F;git-workflows-book?tab=readme-ov-fil...</a> :<p><pre><code> [alias] unstage = reset HEAD # remove files from index (tracking) uncommit = reset --soft HEAD^ # go back before last commit, with files in uncommitted state </code></pre> <a href="https:&#x2F;&#x2F;learngitbranching.js.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;learngitbranching.js.org&#x2F;</a><p>charmbracelet&#x2F;git-lfs-transfer: <a href="https:&#x2F;&#x2F;github.com&#x2F;charmbracelet&#x2F;git-lfs-transfer">https:&#x2F;&#x2F;github.com&#x2F;charmbracelet&#x2F;git-lfs-transfer</a><p>jj-vcs&#x2F;jj: <a href="https:&#x2F;&#x2F;github.com&#x2F;jj-vcs&#x2F;jj">https:&#x2F;&#x2F;github.com&#x2F;jj-vcs&#x2F;jj</a>
MzHN3 个月前
Might be worth mentioning that fsmonitor is Windows and Mac OS only.<p>Also I wish GitHub and GitLab had colorMoved.
评论 #43178085 未加载
schacon3 个月前
Curious what I might have missed that you all put in your `~&#x2F;.gitconfig`
评论 #43179054 未加载
评论 #43181069 未加载
评论 #43177452 未加载
评论 #43176839 未加载
albingroen3 个月前
I’d bet my money on the GitButler team. They’re experts in a small market and I think they’ll do something great. I don’t think their current product is it, but I think they’ll do something great.
iLemming3 个月前
Tip for Emacs users: One easy way to sort the sections in .gitconfig alphabetically - turn them into org-mode headings. replace-regexp &quot;^[&quot; with &quot;^* [&quot;; then mark-whole-buffer; org-sort; finally, replace the headings back to be normal sections.