GitUsage

Differences between revisions 3 and 4
Revision 3 as of 2007-11-19 16:17:24
Size: 2849
Editor: deckard
Comment:
Revision 4 as of 2007-11-20 11:24:41
Size: 2947
Editor: deckard
Comment:
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
foobar xorg % git clone ssh://user-guest@alioth.debian.org/git/pkg-xorg/debian/xorg.git
foobar xorg % git checkout origin/ubuntu
Note: moving to "origin/ubuntu" which isn't a local branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
git clone ssh://user-guest@alioth.debian.org/git/pkg-xorg/debian/xorg.git
git checkout origin/ubuntu
 Note: moving to "origin/ubuntu" which isn't a local branch
 If you want to create a new branch from this checkout, you may do so
 (now or later) by using -b with the checkout command again. Example:
Line 18: Line 18:
HEAD is now at cdbd698... Prepare changelog for upload.  HEAD is now at cdbd698... Prepare changelog for upload.
Line 22: Line 22:
foobar xorg % git checkout ubuntu
Previous HEAD position was cdbd698... Prepare changelog for upload.
Switched to branch "ubuntu"
git checkout ubuntu
 Previous HEAD position was cdbd698... Prepare changelog for upload.
 Switched to branch "ubuntu"
Line 28: Line 28:
foobar xorg % git status
# On branch ubuntu
nothing to commit (working directory clean)
foobar xorg % git log
git status
 # On branch ubuntu
 nothing to commit (working directory clean)
git log
Line 39: Line 39:
foobar xorg 138 % git-mergetool
Merging the files: debian/changelog debian/control
git-mergetool
 Merging the files: debian/changelog debian/control
Line 42: Line 42:
Normal merge conflict for 'debian/changelog':  Normal merge conflict for 'debian/changelog':
Line 45: Line 45:
Hit return to start merge resolution tool (meld):  Hit return to start merge resolution tool (meld):
Line 47: Line 47:
Merge leaves behind some temporary files if there are conflicts, so clean them Merge leaves behind some temporary files if there are conflicts, so clean them.
Line 49: Line 49:
foobar xorg 139 % git clean
Removing debian/changelog.orig
Removing debian/control.orig
git clean
 Removing debian/changelog.orig
 Removing debian/control.orig
Line 53: Line 53:
Now you can do other changes if necessary Now you can do other changes if necessary. Remember to git-add new files.
Line 56: Line 56:
git-add path/to/a-new-file
Line 61: Line 62:
foobar xorg 145 % git commit -a git commit -a
Line 63: Line 64:
When everything is set, push the changes to the repository When everything is set, push the changes to the repository.
Line 65: Line 66:
foobar xorg 146 % git push origin ubuntu git push origin ubuntu
Line 67: Line 68:
and roll a tarball, don't forget to add -i/I as necessary Now it's safe to do a release. Don't forget to add -i/I as necessary, and put the tarball in the parent directory before running debuild.
Line 69: Line 70:
foobar xorg 147 % debuild -I ".git/*" -S -sa debuild -I ".git/*" -S -sa ### for xorg
debuild -i .git/*" -S -sa ### for rest with an orig.tar.gz
Line 71: Line 73:
after that the package is ready to be uploaded! After reviewing the resulting package (debdiff et al) it is ready for upload!

Ubuntu X-SWAT uses git now

We are now using git for the packages with biggest set of changes, namely "xorg" and "xorg-server". This page is a simplified version of [http://wiki.debian.org/XStrikeForce/git-usage the Debian git-usage] page specifically for our needs.

Git archive policy

Basic tutorial

First you need to pull the repository on your disk, and change the working branch.

git clone ssh://user-guest@alioth.debian.org/git/pkg-xorg/debian/xorg.git
git checkout origin/ubuntu
 Note: moving to "origin/ubuntu" which isn't a local branch
 If you want to create a new branch from this checkout, you may do so
 (now or later) by using -b with the checkout command again. Example:
  git checkout -b <new_branch_name>
 HEAD is now at cdbd698... Prepare changelog for upload.

Now you are on the remote branch, and you need to create a local branch from origin/ubuntu

git checkout ubuntu       
 Previous HEAD position was cdbd698... Prepare changelog for upload.
 Switched to branch "ubuntu"

Check the success by running these

git status
 # On branch ubuntu
 nothing to commit (working directory clean)
git log

The first thing usually is to merge with a new Debian release

git pull . debian-unstable <tag>

It most likely complains that there are conflicts, so then make sure you have a merge tool of your choice installed (meld is one alternative) and then run git-mergetool

git-mergetool
 Merging the files: debian/changelog debian/control

 Normal merge conflict for 'debian/changelog':
  {local}: modified
  {remote}: modified
 Hit return to start merge resolution tool (meld): 

Merge leaves behind some temporary files if there are conflicts, so clean them.

git clean
 Removing debian/changelog.orig
 Removing debian/control.orig

Now you can do other changes if necessary. Remember to git-add new files.

<edit>
git-add path/to/a-new-file
dch
git diff

and commit them.

git commit -a

When everything is set, push the changes to the repository.

git push origin ubuntu

Now it's safe to do a release. Don't forget to add -i/I as necessary, and put the tarball in the parent directory before running debuild.

debuild -I ".git/*" -S -sa ### for xorg
debuild -i .git/*" -S -sa ### for rest with an orig.tar.gz

After reviewing the resulting package (debdiff et al) it is ready for upload!

Recovering from mistakes

There are (at least) two ways to revert a change, either reverting and older commit with

git revert <hash>

or by resetting the HEAD if you want to just revert the latest (set of) change(s)

git reset <hash of the new HEAD>

Reverting leaves a message on the log, so it's not a "clean" way to undo changes, but necessary when the changes are already committed to the repository, or when there are changes made after that commit.

X/GitUsage (last edited 2012-08-16 22:16:30 by static-50-53-79-63)