User login

Git

Get a Git diff of the previous commit

Getting a diff (patch-file style display of changes) from a your most recent commit is useful when you commit and it lists three lines changing in a file instead of one. Of course, you should have run git diff --cached before git commit -m "I know what I'm doing.", but when you haven't, or have another reason to take one step back in the history of your work, here is the command that saves looking up the git commit hash.

git diff HEAD^ HEAD

Set your name in

git config --global user.name "My Name"
git config --global user.email "me@example.com"

http://www.lixo.org/archives/2008/06/26/git-tip-set-your-identification-and-colours/

http://help.github.com/git-email-settings/

Be sure to re-add files to stage to commit in Git if you modify them after adding but before committing

Learned something new about git!

If you git add filename and then make some changes to that file before running git commit -m "Helpful commit message." those changes that you saved and tested are not part of that commit. You have to run git add again-- git add adds the exact version of the file at that time, not simply adding the file as a concept to staging.

How to clone a project from Github to work on it

http://github.com/guides/getting-a-copy-of-your-github-repo

This works for other people's repositories also, where you have been given access and when you have your public key.

For instance:

git clone git@github.com:scor/rdfx.git

Get a past version of your project with Git

git checkout old version
git get old copy
git branch checkout revision

http://stackoverflow.com/questions/849265/do-you-need-to-create-a-branch-to-check-out-a-specific-git-revision

basic git commands

Cannot merge error message from Git likely due to an added but uncommitted file

"would be overwritten by merge. Cannot merge."

Git tells you which file it is. Use git status to see if it is added but not committed. Commit it. Do the merge again. It'll probably work.

In the future, check your local state before pulling (or performing an Agaric Capistrano task that includes pulling a commit back down locally).

Syndicate content