forked from ecell/epdp
-
Notifications
You must be signed in to change notification settings - Fork 11
Git commit policy
nilsbecker edited this page May 10, 2011
·
5 revisions
The workflow described here is outdated, see git workflow instead. Keeping it for now for possibly useful tricks
This article files the current Git commiting policy of our project. The policy is also written down in the file DEVELOPMENT
in the main directory of the repository.
$ git checkout common-develop
-
$ git pull
(Updatescommon-develop
to the latest version oforigin/develop
.) -
$ git branch someNewFeatureBranch
(Creates a nice clean branch for you to work on.) - [edit edit]
-
$ make check
(Runs tests to see if you didn’t break anything.) -
$ git add <files_that_contain_changes_that_you_want_to_commit>
(Adds the changes from these files to the staging area.) -
$ git commit
(Commits only the changes from the staging area, not any other changes you also made. That’s the power of git for you right there.) - Write a nice commit message. This requires using
vim
. Start with presssingi
, save and exit with:wq
.
If you prefer to reuse an existing local development branch, and you are sure it does not contain unwanted commits or changes, then replace step 3. by:
3a. $ git checkout yourLocalDevelopmentBranch
3b. $ git rebase common-develop
(This pulls in new commits from common-develop
and replays any local commits you had here on top of it.)
- Email Laurens (
bossenATamolf.nl
) with a pull request. Specify url or directory (at Amolf) and branch (someNewFeatureBranch
). - Wait till Laurens has merged your changes into
origin/develop
. -
$ git branch -d someNewFeatureBranch
(DeletessomeNewFeatureBranch
again. Will refuse if you have commits here that are not also in a different branch, so safe.)
-
$ git checkout common-develop
-
$ git pull
(Updatescommon-develop
to the latest version oforigin/develop
.) -
$ git checkout yourLocalDevelopmentBranch
-
$ git rebase common-develop
(This pulls in new commits fromcommon-develop
and replays your new commits on top of it.) - Solve any merge conflicts.
-
$ make check
(Runs tests to see if you didn’t break anything.) - Email Laurens (
bossenATamolf.nl
) with a pull request. Specify directory and branch. - Wait till Laurens has approved your changes and merged them into
origin/develop
.
-
$ git config --global core.editor <your editor of choice>
(Specifies which editor to use for commit messages.vim
by default.) -
$ git config --global color.diff always
(Makesgit diff
nicely colored.) - Add this to your
.bashrc
(Sets your bash prompt to show which branch you are in, only if you are in a git repository):
if [ -f /etc/bash_completion.d/git ]; then
source /etc/bash_completion.d/git
export PS1=’\W$(__git_ps1 “(%s)”)$ ’
fi
Note that the single and double quotes are the ones next the enter on the keyboard, otherwise it will not work.
- If you prefer to use Mercurial over Git see the Hg-Git mercurial plugin