10 ms·
Learn random facts while pulling code changes
- dfc 14y ago"you don't type git pull every time, do you?" No, I fetch and then merge. "Put those to your .bashrc or .zshrc" git aliases should be added to gitconfig to avoid muddying the global namespace for commands.
- ambrice 14y agoIt's not a git alias. It would be better to do this as a post-merge hook though.
- dfc 14y agoI know it is not a gitalias, it is a shell wide alias for a command that involves git. That is why I said the better solution would be to use gitalias than your shell's alias functionality. With gitalias you can provide the same functionality without creating the possibility for command conflicts.
- medwezys 14y agoI don't like merge commits when you can avoid them.
- waffle_ss 14y agoIndeed... git pull --rebase is your friend (or better yet, set rebase as default strategy for pulls)
- yhager 14y agoI don't know how to run a shell alias using a git alias, so I ended up creating a file ~/bin/fact, and defining the git alias as: [alias] ff = "!fact && git fetch"
- wiredsoul 14y agoIf you're going to do this at least put the 'fact' call before the git command, otherwise it seems to defeat the purpose of reading the fact while the git fetch / merge completes.
- jenius 14y agoPretty fun idea, does anyone know of a good way to make this work on osx?
- Cyranix 14y agoRelated question: How would one write this without the elinks dependency, using curl or wget?
- GuiA 14y agohttp://news.ycombinator.com/item?id=4335963 http://news.ycombinator.com/item?id=4335963
- devgutt 14y agocurl -s randomfunfacts.com | sed -n 's/.*<i>\(.*\)<\/i>.*/\1/p'
- artursapek 14y agoThe poor man's API. I love it.
- medwezys 14y agoIt does work on OSX, you just need to install elinks (brew install elinks ?)
- msbarnett 14y agoIt looks like elinks is available in Homebrew[1], so the only added step is brew install elinks [1]: https://github.com/mxcl/homebrew https://github.com/mxcl/homebrew
- 5teev 14y agoAlso MacPorts, so port install elinks
- RickFromSA 14y ago
- JReptak 14y agoOnly using curl: WARNING: Replace ASTERISK with the asterisk character, keeps italicizing -.- curl -s randomfunfacts.com | grep '<i>' | sed 's/.ASTERISK<i>\(.ASTERISK\)<\/i>.*/\1/'
- JReptak 14y agoOr better yet add color: WARNING: REPLACE ASTERISK with the ATERISK character, keeps italicizing alias facts="echo -ne '\033[36m'; curl -s randomfunfacts.com | grep '<i>' | sed 's/.ASTERISK<i>\(.ASTERISK\)<\/i>.*/\1/'; echo -ne '\033[0m'; tput sgr0" And run it in BG so we don't have to wait for call to website before we pull alias gpl="( facts ); git pull"
- paulbaumgart 14y agoPrepending two spaces to a line will prevent ***automatic formatting***.
- cpeterso 14y agocurl -s randomfunfacts.com | grep '<i>' | sed 's/.*<i>\(.*\)<\/i>.*/\1/'
- devgutt 14y agoyou don need to use grep, only sed -n
- deleted 14y ago[deleted]
- dracoli 14y agowe should merge :] https://chrome.google.com/webstore/detail/bjkhdklfbghoadcamlpmkafgmehcmima?hl=en-GB&utm_source=chrome-ntp-launcher https://chrome.google.com/webstore/detail/bjkhdklfbghoadcaml...
- neeee 14y agoThe sed doesn't work on my box, here's one that does: elinks -dump randomfunfacts.com | sed -n '/^[┌│└]/p'
- Avalaxy 14y agoI dont want to spoil the party but: 1) You really don't need Git to do this. Can you bind almost anything you like to make a call to this randomfact website. 2) The site doesn't only state facts. It says that elephants are the only animals that can't jump. This is simply not true, because snails for instance are animals as well, and it is proven that they can't jump.
- austinlyons 14y agoI keep pulling even though my repo is up to date. These facts are addicting.