GIT
From mISDN.org
Contents |
[edit]
Getting started with the misdn.org git repository
[edit]
Guide for users (anonymous)
- Clone (get the files from the remote repository)
~$ git-clone git://git.misdn.org/git/mISDN.git/ ~$ git-clone git://git.misdn.org/git/mISDNuser.git/
- Pull (update the local files)
~$ git-pull
[edit]
Guide for developers
[edit]
Getting started
As a mISDN developer, you should have a SSH account on git.misdn.org. Please only use git >= 1.5.
- Set environment variables, i.e. by putting the following into your ~/.bashrc:
export GIT_AUTHOR_NAME=<username> export GIT_COMMITTER_NAME=<username>
[edit]
Working with the code
- Clone the remote repository:
NOTE: Don't forget the last slash!
~$ git-clone ssh://<username>@git.misdn.org/var/git/mISDN.git/ ~$ git-clone ssh://<username>@git.misdn.org/var/git/mISDNuser.git/
- Make some changes and commit them (local):
~/mISDN.git$ echo "change" >> test.file ~/mISDN.git$ git-update-index test.file ~/mISDN.git$ git-commit
- Add a file:
~/mISDN.git$ touch test ~/mISDN.git$ git-add test ~/mISDN.git$ git-commit
- Delete a file:
NOTE: -a tells git-commit to recognize deleted files.
~/mISDN.git$ rm test ~/mISDN.git$ git-commit -a
- Merge your changes back into the remote repository:
~/mISDN.git$ git-push
[edit]
Working with branches
- to get on overview of recently used branches, please visit the developers corner
- List the available branches (the current one is prefixed with a *):
~/mISDN.git$ git-branch -a
* master
origin/HEAD
origin/NEWCTRL_BRANCH
origin/mISDN_1_1
origin/master
origin/mqueue
origin/origin
- Switch to another branch (i.e. mISDN_1_1):
~/mISDN.git$ git-checkout -b mISDN_1_1 origin/mISDN_1_1 Switched to a new branch "mISDN_1_1" ~/mISDN.git$ git-config branch.mISDN_1_1.remote origin ~/mISDN.git$ git-config branch.mISDN_1_1.merge refs/heads/mISDN_1_1
[edit]
Hints
[edit]
Restore a deleted file
You deleted testfile and want to restore it:
~/mISDN.git$ git-checkout testfile
[edit]
Revert changes
You modified testfile and want to revert your changes:
~/mISDN.git$ git-checkout testfile
[edit]
Undo your latest commit
NOTE: --soft leaves all your changed files "Added but not yet committed".
~/mISDN.git$ git-reset --soft HEAD^
[edit]
Merging
Consider you committed a bugfix in mISDN_1_1 and want to merge it into the master branch. You'll need the SHA1 object name of your commit (i.e. b185099072facafc22d9f71c2bb73a83bc8deb82).
~/mISDN.git$ git-checkout master ~/mISDN.git$ git-cherry-pick b185099072facafc22d9f71c2bb73a83bc8deb82
This creates a new commit that you might want to push.
NOTE: Your commit's SHA1 object name can be retrieved i.e. via git-log or from the output of git-commit:
~/mISDN.git$ git-commit -a Created commit b185099072facafc22d9f71c2bb73a83bc8deb82 1 files changed, 1 insertions(+), 0 deletions(-)
[edit]
External GIT Howtos/Tutorials
http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html http://www.adeal.eu/starting-with-git.php
