Way to describe remote branches and local references. The language for git-fetch
command to decide how to fetch REFerences (fetch according to refSPEC).
Start with an optional +
1, follow by remote:local
. remote
is the pattern to describe branches on remote. local
is the pattern to describe branches at local.
To demostrate in Ruby will look like:
class RefSpec < Struct.new(:remote, :local)
def self.parse(str)
remote, local, rest = str.split(":")
if remote && !rest
if local
new(remote, local)
else
new(remote, remote)
end
else
nil
end
end
end
refs/heads/
+refs/heads/*:refs/remotes/origin/*
refs/pull/
+refs/heads/*:refs/remotes/origin/*
refs/tags/
For tags
+refs/tags/*:refs/tags/*
You would use it like this:
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- Writing a CI tool
- Working on adding support for forked repositories
- Checking out pull requests locally (GitHub)