git - How can I check a remote's HEAD of a different branch from a shallow clone? -


i changed way servers clone shallow, speed deployment:

git clone -b $branch --depth 1 git@github.com:initech/rounding.git . 

the problem is, update mechanism following:

local=$(git rev-parse head) remote=$(git rev-parse origin/$newbranch)  if [ $local = $remote ];     echo "up-to-date" else     blah... fi 

previously fine, fatal: needed single revision, because git not know existence of other branches.

how can pull in information branch want switch to, , check head commit on origin without checking out (since want leave checkout - it's running server)?

you cannot directly: information not there.

if can consult another, more-complete git repository, can find answer there. precise mechanism (obviously) depend on how go reaching , talking other, more-complete git repository—but there built-in mechanism: git ls-remote.

run git ls-remote manually, in 1 of own repositories, see in action. note calls remote (usually origin you can choose remote; see documentation) via git transport, means whoever runs must permitted access other repository.

note gets these reference names as seen on remote. your git stores your copy of "what other git calls refs/heads/master (branch master)" under your refs/remotes/origin/master. keeps separate your refs/heads/master. git, of course, doesn't have keep master separate master ... their git stores under full name refs/heads/master. means test have change accordingly.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -