Git - Tag عملیات



Tag کردن به ما اجازه میدهد نامهای معناداری برای یک نسخه خاص از برنامه در انبار انتخاب کنیم

Tag ایجاد

بیایید با دستور git tag ببینیم head pointer کجاست. او نام tag را با -a و پیغام آن را با -m وارد میکند

tom@CentOS project]$ pwd
/home/tom/top_repo/project

[tom@CentOS project]$ git tag -a 'Release_1_0' -m 'Tagged basic string operation code' HEAD

اگر بخواهیم یک commit خاص را tag کنیم، ازcommit ID آن، به جای head pointer استفاده میکنیم Tom از دستور push برای انتقال تغییرات به git server استفاده میکند

[tom@CentOS project]$ git push origin tag Release_1_0

دستورات بالا نتایج زیر را در برخواهند داشت:

Counting objects: 1, done.
Writing objects: 100% (1/1), 183 bytes, done.
Total 1 (delta 0), reused 0 (delta 0)
To gituser@git.server.com:project.git
* [new tag]
Release_1_0 −> Release_1_0

دیدن Tags ها

Tom یک tag ایجاد کرد. حالا Jerry میخواهد tag های موجود را با استفاده از دستور git tag -l ببیند:

[jerry@CentOS src]$ pwd
/home/jerry/jerry_repo/project/src

[jerry@CentOS src]$ git pull
remote: Counting objects: 1, done.
remote: Total 1 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (1/1), done.
From git.server.com:project
* [new tag]
Release_1_0 −> Release_1_0
Current branch master is up to date.

[jerry@CentOS src]$ git tag -l
Release_1_0

Jerry از دستور git show با نام tag استفاده میکند تا جزئیات بیشتری از tag را ببیند:

[jerry@CentOS src]$ git show Release_1_0

دستورات بالا نتایج زیر را در برخواهند داشت:

tag Release_1_0
Tagger: Tom Cat <tom@tutorialspoint.com>
Date: Wed Sep 11 13:45:54 2013 +0530

Tagged basic string operation code


commit 577647211ed44fe2ae479427a0668a4f12ed71a1
Author: Tom Cat <tom@tutorialspoint.com>
Date: Wed Sep 11 10:21:20 2013 +0530

Removed executable binary

diff --git a/src/string_operations b/src/string_operations
deleted file mode 100755
index 654004b..0000000
Binary files a/src/string_operations and /dev/null differ

پاک کردن Tag

Tom از دستور زیر برای پاک کردن tag از انبار محلی و remote repository استفاده میکند:

[tom@CentOS project]$ git tag
Release_1_0

[tom@CentOS project]$ git tag -d Release_1_0
Deleted tag 'Release_1_0' (was 0f81ff4)
# Remove tag from remote repository.

[tom@CentOS project]$ git push origin :Release_1_0
To gituser@git.server.com:project.git
- [deleted]
Release_1_0
Advertisements