#introduction to using git for factorio mods
1 messages ยท Page 1 of 1 (latest)
Allright so in this thread im helping him with trying to get an understanding of git and using it for factorio mods.
It will not the "most ideal" setup but rather the bare minimum to get a basic understanding on how to use it.
Others are free to lurk and share additional tips & tricks, and hopefully this thread gets found in the future and also help other aspiring modders to get their git game off the ground, so yes without further adue, lets get started:
Whilst "git" is compatible with many online git platforms, for the purpose of this tutorial we'll stick with github
so step one is making sure you either register or login: https://github.com/signup
allright, ontop step 2, a git gui 
whilst prominent git users prefer using the commandline we'll be sticking to applications that offer a gui in which you can quickly see new/modified files, many such applications exist and will function in a similar fashion, but for this example we'll use github desktop: https://desktop.github.com/download/
once installed it should prompt you to login to github via the browser
and if not, find the settings page which contains a login button
ok im in
now there are two paths to take: creating a new github repository on the website, or initializing a git repo within your local modding folder, though you have an existing mod for the purpose of avoiding "git init" for this simple tutorial we'll start with a new repository
go to https://github.com/new and set the repository name (next to your profile picture) to the name of your mod's folder
do not include the version number
so something like:
ok then?
the rest of the settings on the page can be left as their default, though you might want to pick a licence so the repository is not completely empty
after creating the repo you should have landed on it's new page
now in the github desktop app you should be able to search for the repo
do not click anything else yet, just confirm it is in the list
found
head into your factorio mods directory
we'll rename the mining drill mod's folder and add _old or _tmp after the name
we'll be "cloning" the git repository directly into the mods folder during this tutorial and names cannot collide, afterwards we'll merge the folders again
what is the problem?
idk im confused now
what did you name your git repository?
just test for now because after this i would've made the actual age of production repo
it'll be easier if you just made the age-of-production repository now
the same way will be fine
oh hang on looks like your mod's name on the portal is with uppercases
so the next step, rename your current Age-of-Production mod's folder to Age-of-Production-old
done
now in the github desktop application search for the repo and press clone
set the "local path" to your factorio mods folder
yes
do you now have both a Age-of-Production and a Age-of-Production-old folder?
allright, now drag all the contents of the old folder into the new one
mhm
now in the github desktop app you should see a whole list of changed files
there should be a checkbox to select all of them
yeah
now we should come up with a nice message, customary the first one is called "Initial commit" but since you've created a licence during repository creation that message is already taken,
so perhaps an "Upload mod to git" / "Added mod to git" / "Initial commit 2: electric boogaloo"
what
enter "any text" in the Summary (required) field
ok then?
commit to main
and afterwards near the top there should be a "push origin" button with a number beside it
that'd be a good thing
could you send me a screenshot of the application? i feel like something didn't quite work
ah i see, its simply so big that the initial push is taking several minutes
the pushing finished
and my wifi sucks currently
well actually- no im going offtopic its not important
anyhow
whats next
a pat on the back for having uploaded your mod to git ๐
https://github.com/AndreusAxolotl/Age-of-Production
-# sorry for everyone else following along now or in the future, its not exactly a clear tutorial 
because you named your licence LICENCE.txt
the convention is to have it without the extention
now in the summary field type "Deleted duplicate licence", commit & push
or if you deleted it from the github site, then press pull
i just commited the change like github automatically named it
from the site
its done
what now
pull
?
at the top under repository, there should be a pull button
on the site or on the desktop?
desktop
ok done
now that your mod is safely within git, this will be your workflow:
- make any amount of changes to your mod
- when done and wanting to stash/mark your work, select all the modified files and write in the summary field what you did, like "added new entity" / "fixed bug x" / etc
- commit
-push
and when you get a pull request from someone (e.g. me) you'll want to:
- push
- merge the pull request
- pull
(not pushing first will lead to having to make a merge, which can be a can of worms initially)
the old folder should be empty now anyways, so yes
and also
i head there was a thing to directly upload stuff from the repository on the factorio site
yk how to do that?
that would be the fmtk vscode extention
i haven't really played around with it yet, i wrote my own upload script
oh
@tall cedar so about the surface limit?
now that you've added the project to git i can start writing some code for it
yeah
will it take long?
i'll get back to you later today
It's also possible with Github Actions. Fgardt has made a whole git repo template that has this implemented which you can clone and give it your Mod portal API key and it works automagically.
It does require you to work in separate branches as not to upload a new version of your mod every time you push to main.
there's also https://github.com/Penguin-Spy/factorio-mod-portal-publish/ which only activates whenever a new version tag is pushed (and doesnt auto generate changelogs)
how does this work