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

Retrieve:

git describe --tags

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

2.1-441-gff635ba

  Category: GIT
  Comments: None

How to checkout Nova Folsom or Grizzly branch on github

By polfilm,

Clone branch directly

git clone --branch stable/grizzly https://github.com/openstack-dev/devstack.git

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
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/stable/folsom
  remotes/origin/stable/grizzly
 
 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

http://rtomaszewski.blogspot.co.uk/2013/05/how-to-checkout-nova-folsom-or-grizzly.html

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 http://192.168.1.xxx:8080/tfs/CollectionName/ $/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 https://192.168.1.xxx:8443/svn/Project01/ Project01
cd..
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 <first.last@example.com>
VisualSVN Server = Visual SVN Server <svn@example.com>