Handmade Hero»Forums»Code
Arne Döring
4 posts
git repository with a commit for each day
I thought it would be nice to have a git repository, that has a commit for each day. Would be nice if it would be by default in git, but it is also not hard to do it on your own.

Here is a bash script that does it, if you have all zip files with the days in the same folder:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
# license: Public Domain, do whatever you want
# ignore zip files for git
echo '*.zip' > .gitignore
# initialize git with all files that are not yet from the zip file
# this includes this script
git init
git add .
git commit -m "initial commit"

# now we all all files to the repository
for file in *.zip; do
  unzip -o $file
  git add .
  # extract a tag name from the zip file, basically day_xxx
  tag=$(echo $file | sed s/handmade_hero_// | sed s/_source.zip//)
  # at the moment the tag and the description is the same, would be nice to have an actual description (maybe later)
  git commit -m $tag
  
  git tag $tag
done


this script just runs a few seconds, but now you have git, and you can use all the git tools on the files, and you can see the changes for each day. I hope someone likes it.
Mārtiņš Možeiko
2559 posts / 2 projects
git repository with a commit for each day
More topics for creating git repositories for HH source:
https://forums.handmadehero.org/i...p/forum?view=topic&catid=4&id=480
https://forums.handmadehero.org/i...p/forum?view=topic&catid=4&id=240
Arne Döring
4 posts
git repository with a commit for each day
yay, I am not alone with this request, but at least there is someone who is interested in it.
Nuno
18 posts
git repository with a commit for each day
I took a couple of scripts I found to do that and came up with this:

https://gist.github.com/nsenica/cbc5a4975666d7b02164

Feel free to use and adapt it :)