User login

version control

Understanding past changes with diff and git log

In figuring out what changed in a theme's files (an incorrectly made subtheme; instead of overriding the base themes stylesheets, changes should have gone into its own files with different names), these commands were useful.


diff -uP themes/bartik/css/colors.css sites/default/themes/dgd7theme/css/style.css > theme.diff
git log --cc sites/default/themes/dgd7theme/css/style.css > log.diff

Kept running them for the three different files, and reloading theme.diff and log.diff in gvim to see the changes. Quite convenient.

Pushing our local repository to Gitorious


git checkout master
git remote add origin git@gitorious.org:remarkup/remarkup.git
git push origin master

This was for a module named "remarkup" as covered in http://definitivedrupal.org/node/90

Git undo part of a commit

To revert an entire commit.

git checkout <file>
re-checkout <file>, overwriting any local changes

Should be able to git add changed files that you are interested in committing the revised changes and git commit --amend

http://stackoverflow.com/questions/927358/git-undo-last-commit

See what's about to be committed when using git, and remove something before committing

git diff of files that have been staged ie 'git add'ed
git diff --cached

http://www.commandlinefu.com/commands/view/1242/git-diff-of-files-that-have-been-staged-ie-git-added

$ git commit ...
$ git reset --soft HEAD^ (1)
$ edit (2)

And just commit again.

Undo a git add - remove files staged for a git commit

git reset filename.txt

Will remove a file named filename.txt from the current index, the "about to be committed" area, without changing anything else.

To undo git add . use git reset (no dot).

Ignore all Vim temporary files


v ~/.gitignore

*.swp
*.swo


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

Syndicate content