Live data from Hacker News

A list of cool features of Git and GitHub

github.com

11–20 of 26 posts

Re: A list of cool features of Git and GitHub

#11

> To add more color to your Git output: git config --global color.ui 1 Don't do this. The default (since 1.8.4) is auto, which adds colors if the output goes to a terminal, but doesn't if the output goes somewhere else (e.g., a pipe). That is probably what you want (and already have). I fell for this myself at some point. Somehow expecting there to be more colors, or full color support, or something like that — Nope.

The book has a nice discussion: http://git-scm.com/book/en/v2/Customizing-Git-Git-Configurat...

> The default setting is auto, which colors output when it’s going straight to a terminal, but omits the color-control codes when the output is redirected to a pipe or a file.

> You can also set it to always to ignore the difference between terminals and pipes. You’ll rarely want this; in most scenarios, if you want color codes in your redirected output, you can instead pass a --color flag to the Git command to force it to use color codes. The default setting is almost always what you’ll want.

Re: A list of cool features of Git and GitHub

#17

> To add more color to your Git output: git config --global color.ui 1 Don't do this. The default (since 1.8.4) is auto, which adds colors if the output goes to a terminal, but doesn't if the output goes somewhere else (e.g., a pipe). That is probably what you want (and already have). I fell for this myself at some point. Somehow expecting there to be more colors, or full color support, or something like that — Nope.

    git config --global --unset color.ui

Re: A list of cool features of Git and GitHub

#18
post #6

Any way how to automatically mirror an external Git repo to GitHub? Any webhooks for that?

Can't we download and then push to github repo?

Yeah, but the point is to have it done automatically. It's easier to fork a repo on GitHub than on e.g. CGit, so I would like to mirror an external repo to GitHub and keep it in sync.

Re: A list of cool features of Git and GitHub

#19

> Adding ?w=1 to any diff URL will remove any changes only in whitespace, enabling you to see only that code that has changed. Annoyingly, this doesn't work for pull requests.

weirdly, an empty line is included in the example output. Does that not count as whitespace?

Re: A list of cool features of Git and GitHub

#20
post #6

Any way how to automatically mirror an external Git repo to GitHub? Any webhooks for that?

The feature does or did exist, but hidden. The early versions of GitHub Enterprise (called GitHub FI) exposed this and it can be seen in action in some places (e.g.: https://github.com/ghc; look at the "mirrored from" subtitles). I really wish GitHub would expose that feature publicly, though. The post-receive advice they give only works if you have full access to the master repo and misses out on recording the "this is a mirror" piece of metadata on the repository, which is useful for people who might try to open PRs etc
Post reply on HN