Has anybody seen a "git for people who have no idea how to use git" tutorial?<p>I use git for keeping track of some personal projects, but the extent to which I understand how to use it is:<p>"git commit origin master"<p>We had a hackathon this weekend, and our team had three people on it. I wanted to make it so that they could also commit code into the same repo (I think this it the right term?), but had absolutely no idea how to actually make this happen, and googling didn't seem to give answers that were geared towards somebody with my level-of-understanding of git.
>> Zero a branch to do something radically different<p>There's another way to do this:<p><pre><code> git checkout --orphan new-branch</code></pre>
> Making ‘git diff’ wrap long lines ... My git diff would not wrap lines and leave a lot of information hidden from view in my terminal.<p>Git is so ... stone age!
> Search for a string in all revisions of entire git history<p>The example they show can be shortened by using xargs:<p><pre><code> git rev-list --all | xargs -n1 git --no-pager grep -F "search string"
</code></pre>
And here it is as an alias that you can add to your .gitconfig:<p><pre><code> grepall = "!f() { git rev-list --all | xargs -n1 git --no-pager grep -F \"$1\"; }; f"</code></pre>
I was not aware of the `git config` option for wrapping long files, worth the price of admission just for that for me.<p>Edit: there's a `git diff` tip in there, but this comes up a few times so if anyone needs to do patches from git for svn repos do `git patch --prefix=none $DIFF1 $DIFF2 > some.patch` share and apply with `patch -p0 < some.patch`.
These seem like the kind of things you'd end up using once in a blue moon. No point in memorizing them.<p>Am I alone in using git extensions? I've been very happy with it and its ability to display git's "state" right in the window. I usually have one monitor with VS and one with GitExtentions
>> Making a more recent branch the new master<p>Why don't just use "git reset --hard <sha-of-the-better-branch>"?<p>At least if the better-branch and master commit in common is the last commit in master so no history rewrite will happen when pushing.
Git is full of nice tricks, this is a good collection. One it didn't mention that I use a lot, is manipulating history with human-readable dates:<p><pre><code> git whatchanged --since="yesterday"
git revert master@{"1 month ago"}</code></pre>
I ask the same thing as blhack, I would like a tutorial. I only know how to use the basics, pushing to github and heroku, and I've been using it for a long time.