Git

From Debuntu

Jump to: navigation, search

Contents

Git Tags

Listing existing tags

git tag
v0.0.1

Showing history for a given tag

git show v0.0.1
...
...

Creating a new tag

Current commit

git tag -a v0.0.2 -m "tag message"

Older commit

$  git log --pretty=oneline
cccccccc commit 3
bbbbbbbb commit 2
aaaaaaaa commit 1
$ git tag -a v0.0.2 -m "tag message" bbbbbbbb

will create tag v0.0.2 on commit bbbbbbbb .

Pushing it remotely

$ git push --tags
Counting objects: 6, done.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 445 bytes, done.
Total 4 (delta 2), reused 0 (delta 0)
To git:repo_url/repo.git
 * [new tag]         v0.0.3 -> v0.0.3

Deleting a tag

Locally

$ git tag -d v0.0.3
Deleted tag 'v0.0.3'

Remotely

$ git push -v --dry-run origin  :refs/tags/v0.0.3
Pushing to git:repo_url/repo.git
To git:repo_url/repo.git
 - [deleted]         v0.0.3
$ git push origin  :refs/tags/v0.0.3
To git:repo_url/repo.git
 - [deleted]         v0.0.3

Merging

Suppose you are on master branch and you want to merge a remote branch git://gitserver.srv/path/to/repo.git to master.

git pull git://gitserver.srv/path/to/repo.git master
...
...

Distributing a package

Assuming that you are in the repository root folder, you can create a .tar.gz archive available to distribution by using the following:

git archive --format=tar --prefix=mypackage-0.0.1/ HEAD | gzip > ../mypackage_0.0.1.orig.tar.gz 

this will generate mypackage-0.0.1.tar.gz

or, using a known tag:

git archive --format=tar --prefix=mypackage-0.0.1/ v0.0.1 | gzip > ../mypackage-0.0.1.tar.gz
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Google AdSense