Archive for the 'git' Category

30
Sep
11

git svn fetch on windows


For some reason, my git svn fetch only brings a few revisions before stopping. So, I wrote a script to continue fetching until the string for a certain revision hasn’t been seen:


limit = "rXXXX" # pull until you see this string somewhere
stop = false
pull_number = 0
process = nil

trap("SIGINT") do 
  puts "Interrupt requested"
  stop = true
  Process.kill("KILL",process.pid) if process
end


loop do
	pull_number += 1
	break if stop
	process = IO.popen("git svn fetch")
	puts "pull number #{pull_number}"
	
	process.each_line do |line|
		puts line
		if line=~/#{limit}/i
			stop = true
		end
	end	
end

02
Sep
11

enabling color output in git


git config --global --add color.ui true

25
Aug
11

git import repo as subdir


Note: the merge will fail if you have no commits.


git remote add -f other_repo /path/to/other_repo
git merge -s ours --no-commit other_repo/master
git read-tree --prefix=path_where_other_repo_will_be/ other_repo/master -u

23
Aug
11

convert git repo to mercurial


Enable the convert extension by adding this in the .hgrc:


[extensions]
convert=

Then:


hg convert --datesort git_repo location_of_new_hg_repo

20
Aug
11

work with git, push to mercurial repo

I would like to give credit for most of this information to Chris Adams’s article. Thank you Chris!

  1. Install git
  2. Install Mercurial
  3. Get hg-git from hg-git page
  4. NOTE: If you install TortoiseHG with Mercurial, you get dulwich for free. I don’t know if this applies for a regular Mercurial install as well ( I always get the package that contains TortoiseHG )
  5. Open the .hgrc file, and add this to it:

    
    [extensions]
    hggit=/path/to/extracted-hg-git/hggit
    bookmarks=
    [git]
    intree=1
    
    [bookmarks]
    track.current=True
    
  6. hg clone hgrepo
  7. Create a bookmark from the first revision of Mercurial’s default branch:
    
    hg book hg/default -r default
    
  8. Export it to git:
    hg gexport
  9. Create the git master branch:
    git branch --track master hg/default
  10. The git repository is a bare one, so, you should clone your repo elsewhere to work on it:
    git clone repo new_repo_location
  11. Work on new_repo_location, do commits, and then do a push so the changes get back to the Mercurial repo
  12. Go back to the original Mercurial repo, and import the git changes:
    hg gimport
  13. Push them via Mercurial

27
Jan
11

setting an external diff tool for git


Use this:


set GIT_EXTERNAL_DIFF=...




Blog Stats

  • 281,739 hits