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)