Push Lots of git commits at once

February 07, 2019

in git

I tried to import an old 21000 commit Repo into git, and gitlab didn’t like this. So I had to push multiple times.

The magic here is the ~ operator, refers to a commits parent. Basicly I’m telling git in a loop to push only commits older then n generations.

#!/bin/bash
for i in $(seq 22000 -900 0)
do
   git push -u origin master~$i:master
done
git push -u origin master:master

(source: Nils Werner on StackOverflow)


Created with getavataaars.com

Hi, I'm Karsten!!!

I live in Munich and I work at InterNations
I like working with React and Symfony, I like to travel, call myself a sneakerhead, play lots of Destiny, and sometimes take lots of photos.
If you want to, you can follow me on Twitter, Unsplash, and GitHub