Pollux's corner
  • Blog
  • BSD
  • Databases
  • Debian
  • General
  • Programming
  • Security

[archives] [tags]

links

  • To Linux and Beyond
  • n0secure
  • Dindinx
  • A Few Thoughts on Cryptographic Engineering
  • Planet Debian
  • Planet Clang
  • Planet PostgreSQL

Social

  • @pollux7
  • github
  • debian

Tags

  • Compiler
  • Security
  • Netfilter
  • Programming
  • Firewall
  • Debian
  • Ulogd
  • OCaml
  • Work
  • LLVM
  • [all tags]

Pollux's corner Git

Git rocks

Date Wed 05 November 2008 Tags Programming Git

No news here, this post is mostly a note for myself, to remember some commands for git:

Creating a repository to be shared between several hosts (with an existing project)

On the server:

mkdir project.git
cd project.git
git --bare init

On the remote host:

cd project
git init
git remote add origin ssh://server/var/git/project
git config branch.master.remote origin
git config branch.master.merge refs/heads/master

Now you can make the first commit:

git add .
git commit -m "First commit"
git push
Fix a mistake in a previous commit
  1. Save your work so far.
  2. Stash your changes away for now: git stash
  3. Now your working copy is clean at the state of your last commit.
  4. Use ‘git rebase -i’, and use the ‘edit’ command on the commit you want to edit
  5. Make the fixes. (If you just want to change the log, skip this step.)
  6. Commit the changes in “amend” mode: git commit —all —amend
  7. Your editor will come up asking for a log message (by default, the old log message). Save and quit the editor when you’re happy with it.
  8. The new changes are added on to the old commit. See for yourself with git log and git diff HEAD^
  9. Re-apply your stashed changes: git stash apply
  10. Continue happily with your life.

I’m a happy git user, it really rocks.

Page 1 / 1