You may also want to use the --oneline
and the --decorate
native options, in case you need to use git-log on a machine where you don't have your own aliases.
You don't need that condition:
if [ "$NEEDS_STASH" -eq "1" ] ; then
git stash;
else
echo "Nothing to stash.";
fi;
If there's nothing to stash, git-stash will tell you.
@vogelar I guess you could've just ignored me if it was just for your own reference. Anyway, it's much nicer to read now, thanks :) +1 for the effort.
@vogelar I got that... What I meant is that I would have expected you to digest it and sum the key parts for me. I may read your link, but I won't upvote your protip. In fact, I would downvote it if I could, cuz' a lazy copy-paste with no explanations is not a protip.
TS;DU (Too Short, Didn't Understand)
I have no clue what your 'code' does, what it's for, if it can be useful to me or not.
A screenshot would be great.
EDIT: Much better, thanks. I might give it a try :)
Nice one. You can also use SSHFS if you don't need the whole performance stuff, cannot setup new services or are concerned about encryption if you cannot install NFS 4 (providing that SSH is already set up on the remote of course).
Ha, I know that feel too; I used to save mine on Dropbox as well but I've recently switched to using gists for that kind of things, I find it more flexible. Here's mine, for that matter.
Seeing your folder / files aliases, you might want to have a look at fasd (and / or my protip about it in the meantime), it's a real time saver.
You might also want to check the pgrep
and pkill
commands, not that much of an improvement but it's just good to know they exist :)
I personally prefer to use git's --no-pager option with a good ol' alias (alias gp='git --no-pager'
) whenever I need it.
Nice tips. Thanks for sharing !
Interesting trick. Thanks for sharing
Breaking stuff remotely just became a lot easier. Thanks for sharing :)
Nice list that can come in handy. You can also use atool for managing file archives of various types with a single command (see atool's man page for usage information).
Interesting use of the --intent-to-add
option. I personally prefer the interactive mode, but this is worth knowing. Cheers
I like the idea. Very nice! Thanks for sharing
That's not shell, that's ruby. Here's the shell-only equivalent to this; for those who, like me, don't have ruby and thought this protip was about shell:
$ cat /dev/urandom | tr -dc '0-9a-zA-Z!@#$%^&*_+-' | head -c 15
Cool tip. Cheers
Nice tips ! Cheers
Nice option, thanks for sharing. Note that you can disable the pager using the --no-pager option: $ git --no-pager diff --word-diff
I think you might have different commit and author dates. Git-log by default shows the author date and so does your log format; whereas --since and --until seem to filter by commit date.
You don't have to specify the entire date. Haver you tried with --since=2.days.ago --until=yesterday ?
Or, juste use the --since and --until options.
Even if you're an advanced git user, git-pull is perfectly safe whereas git-rebase is not. If you're updating a branch you're working on, you'll most likely want to fetch and check the changes before merging. But even if you don't, you can undo a blind git-pull with no harm to your repository nor your history by doing a simple git-reset (--hard or whatever option you need).
@cassianoleal @jwebcat I apologize for being a bit aggressive. All I wanted to say is that git-pull is absolutely not evil, nor dangerous, nor dead; and git-rebase is a nice tool for special cases but I can't see any reason why it should be a better approach than git-pull / git-merge.
@cassianoleal Ha, yeah thanks for pointing out that commit parents mistake. Edited :)
A spaghetti graph is perfectly bisectable, and does not lie about when you've committed changes or merges. I don't see the problem with using git-pull blindly; that's the safest way to go if you're a begitnner or don't get or don't need to get (yet) what git is all about.
The only drawback that seems to be valid is that git-pull does not produce a "linear" history graph but hey, that's exactly what Git wasn't made for. Git tries very hard not to mess up with your history and therefore has made merging changes easy; if you do rebase your upstream branches it seems to me you'd better use SVN instead as it's exactly the way SVN works and what Git is trying to avoid IMHO.
@cassianoleal @jwebcat This is bullshit. Git-pull is not evil at all, nor it is dead. All it does is a fetch and a merge in one go. If you find yourself fetching and merging often without changing anything in the process (and this WILL happen, if you update repos or branches you've not worked on for example), why not using git-pull ?
Also, merge commits aren't meaningless, even when merging your upstream branches. They're still commits and as such, they have all the informations normal commits usually have: parents (2 or more for a merge) so that you have a track of what was the repo's state when the merge has been done, a commit message, an author and commiter date / name / email, a reflog identity, they can provide you with stats and diff (and therefore patches) and, most importantly, they're bisectables.
@manuite I use git-flow on a daily basis and it's really a good model. Don't get too excited about hotfixes though, they should be used only rarely ;)
What you need is "fasd". Check https://coderwall.com/p/k0wzwq .
Also, I personally prefer http://alias.sh/go-back-n-directories more than the "..." aliases.
Basics, but still a good reminder.
Nice one! Quick and easy, thanks
Hm, good to know! Thanks
This only the patch mode. The interactive add is -i, --interactive.
Still, good tip : )
Nice tip, thanks!
Nice tip, thanks. You might want to symlink git-punchcard into /usr/local/bin instead of copying it.
I like the "read-into-vim" trick, but you should note that netcat transmits whatever you're sending in cleartext, so better not use this method with sensitive data. You can add a security layer by tunnelling this through SSH, but generally you might want to consider using the scp command instead as it is secure and has bash-completion enabled for both your locally configured SSH hosts AND remote paths.