User login

Git

Ignore all Vim temporary files


v ~/.gitignore

*.swp
*.swo


git config --global core.excludesfile ~/.gitignore

Getting a git diff with a relative path (no a/ b/ prefixes)

--no-prefix

Do not show any source or destination prefix.

Reference

http://www.kernel.org/pub/software/scm/git/docs/git-diff.html

Replace local files or directories with repository version

git rm -rf directory-that-annoys-us-locally-but-is-ok-in-repository
git pull
git checkout directory-that-annoys-us-locally-but-is-ok-in-repository

Not pretty or proper but it works.

Choosing all the remotely changed files in a git conflicted merge

Stricken with fear at the thought of handling a huge conflicted merge file by file, when you know you can just pick one side of the conflict and be done with it?

When

git pull

gives you the bad news...

git mergetool

is usually the first recourse.

Used meld, my default for git mergetool, for the first one. Which fortunately was the only one i wanted to merge manually.

I refused to merge the next one and then took the provided opportunity to cancel the merge.

Then:

Agaric Quick Tip: if git status works yet 'not a repository', you're in a symlink

If git status works and git anything else doesn't, you are probably in a symlink.

ls -la doesn't show a .git directory, but git status gives results, but git pull says it's not a git repository?

cd up another directory or two (one at a time) and ls -la to see.

What are your git shortcuts? Here are mine.

Two whole words were too much for me for the commonly used git commands, so i created three-letter aliases.

Maybe if we share, we won't be utterly useless if we are lucky enough to work on one another's machines when we are forced, unready to fly with our stubby three-letter wings, out of our own nests.

Clone a git repository that is behind basic HTTP authentication

git clone http://username:password@git.example.com:80/git/project.git

If you do not want to put your password directly in plain text, maybe leaving it out will cause you to be prompted for it.

Harmless Git weirdness: git rm -r does not delete physical files, but doesn't list them as untracked either

Somehow, in git 1.6, after running git rm -r example to get rid of a directory (called example), it leaves the files there but from then on ignores them. git status lists nothing, ls shows the directory example is still there, and then rm -rf example removes the directory and git status still shows nothing.

Syndicate content