Category: GIT

Git: Few Good Commands

By polfilm,

To move repo with history

git clone --bare <old_repo>
cd into bare old_repo and: git push --mirror <new_repo>

To clone from HTTPS with self-generated cert

git -c http.sslVerify=false clone https://<repo>

Restore all deleted files in folder

git ls-files -d | xargs git checkout --

Automatic Versioning
Begin Versioning:

git tags -a 2.1


git describe --tags

Result similar to this where 411 is number of commit for above given tag.


  Category: GIT
  Comments: None

How to checkout Nova Folsom or Grizzly branch on github

By polfilm,

Clone branch directly

git clone --branch stable/grizzly

Create local repo branch with copy…

git checkout -b folsom  remotes/origin/stable/folsom
Checking out files: 100% (2510/2510), done.
Branch folsom set up to track remote branch stable/folsom from origin.
Switched to a new branch 'folsom'
git branch -a
* folsom
  remotes/origin/HEAD -> origin/master
 git branch -a -v
* folsom                        6740c41 Check QCOW2 image size during root disk creation
  master                        e4f05ba Imported Translations from Transifex
  remotes/origin/HEAD           -> origin/master
  remotes/origin/master         e4f05ba Imported Translations from Transifex
  remotes/origin/stable/folsom  6740c41 Check QCOW2 image size during root disk creation
  remotes/origin/stable/grizzly 159fdd2 Merge "Detach volume fails when using multipath iscsi" into stable/grizzly

Mirror TFS to GIT with History

By polfilm,

First Download Git-TF for VS TFS 2012

mkdir TFS
cd TFS
git-tf clone --bare --deep $/ProjectSourceName01
mkdir ProjectSourceName01Tmp
git clone --bare ProjectSourceName01 ProjectSourceName01Tmp
cd ProjectSourceName01Tmp
git push --mirror ssh://git@192.168.1.yyy/ProjectSourceName01.git

Then to clone back and double check it works

mv ProjectSourceName01 old-ProjectSourceName01
mv ProjectSourceName01Tmp old-ProjectSourceName01
git clone ssh://git@192.168.1.yyy/ProjectSourceName01.git

Mirror SVN to GIT with History

By polfilm,

This is actually a quite simple procedure:

apt-get install git git-svn
mkdir SVN
cd SVN
mkdir Project01
mkdir Project01Tmp
git svn clone --stdlayout --no-metadata -A users.txt Project01
git clone --bare Project01 Project01Tmp
cd Project01Tmp
git push --mirror ssh://git@192.168.1.yyy/Project01.git
mv Project01 old-Project01
mv Project01Tmp old-Project01Tmp
git clone ssh://git@192.168.1.yyy/Project01.git

users.txt file should be in the following format

user1=First Last <>
VisualSVN Server = Visual SVN Server <>