---
title: "git tags 使用 远程创建git tags 删除（小抄版）"
author: "夜鸣猪"
date: "2012-08-01T21:13:10Z"
tags: []
categories: ["编程语言"]
slug: "git-tags-git-tags"
draft: false
lastmod: "2013-04-18T03:20:36Z"
id: 1616461
url: "https://hlee.iteye.com/blog/1616461"
---

[Reference](http://hlee.iteye.com/blog/669831)


update
0.5 获取远程tag

```ruby

#my_abc是tag号
git clone http://git.abc.net/git/abc.git
git checkout my_abc OR git checkout -b new_branch my_abc
```



update v2
获取远程tag or branch
code="java"]$ git ls-remote --heads origin

> 5b3f7563ae1b4a7160fda7fe34240d40c5777dcd  refs/heads/1-2-stable
> 71926912a127da29530520d435c83c48778ac2b2  refs/heads/2-0-stable
> 2b158543247a150e8ec568becf360e7376f8ab84  refs/heads/2-1-stable
> b0792a3e7be88e3060af19bab01cd3d26d347e4c  refs/heads/2-2-stable
> d6b9f8410c990b3d68d1970f1461a1d385d098d7  refs/heads/3-0-unstable
> f04346d8b999476113d5e5a30661e07899e3ff80  refs/tags/v0.13.3



```ruby

git pull origin refs/tags/v0.13.3
git pull origin refs/heads/2-2-stable

```


创建
1. 本地创建tags


```java
git tag -a v1.1 -m "new release"
```


1.5 查看本地tags


```java
git tag -l
```


2. push到服务器端

```java

git push --tags
```


2.2.1 创建和删除远程branch

```ruby
git push origin head:newbranch_name 
git push origin head:feature/newbranch_name   

#删除远程分支，其它开发者要git branch －d －r 分支  
git push origin :newbranch_name  

```


2.3 删除本地tag


```java
git tag -d v1.1
```


3. 删除服务器端远程tag


```java
git push origin :refs/tags/v1.1
```


4. 查看远程服务器端


```java
$ git remote show origin
```


> * remote origin
>   URL: git://github.com/rails/rails.git
>   Remote branch merged with 'git pull' while on branch master
>     master
>   Tracked remote branches
>     1-2-stable 2-0-stable 2-1-stable 2-2-stable 3-0-unstable master



```java
$ git ls-remote --heads origin
```


> 5b3f7563ae1b4a7160fda7fe34240d40c5777dcd  refs/heads/1-2-stable
> 71926912a127da29530520d435c83c48778ac2b2  refs/heads/2-0-stable
> 2b158543247a150e8ec568becf360e7376f8ab84  refs/heads/2-1-stable
> b0792a3e7be88e3060af19bab01cd3d26d347e4c  refs/heads/2-2-stable
> d6b9f8410c990b3d68d1970f1461a1d385d098d7  refs/heads/3-0-unstable
> f04346d8b999476113d5e5a30661e07899e3ff80  refs/heads/master



给同行个[链接](http://blog.ashchan.com/archive/2008/06/30/tags-on-git/)