#introduction to using git for factorio mods

1 messages ยท Page 1 of 1 (latest)

tall cedar
#

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

sand moss
#

great

#

i already have an account

tall cedar
#

allright, ontop step 2, a git gui ChibiHappy

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/

sand moss
#

its downloading

#

alrigyht installing

tall cedar
#

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

sand moss
#

ok im in

tall cedar
#

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:

sand moss
#

ok then?

tall cedar
#

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

sand moss
#

mhm

#

done

tall cedar
#

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

sand moss
#

found

tall cedar
#

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

sand moss
#

problem

#

the mining drill mod
is just age of production

#

this is an update

tall cedar
#

what is the problem?

sand moss
#

idk im confused now

tall cedar
#

what did you name your git repository?

sand moss
#

just test for now because after this i would've made the actual age of production repo

tall cedar
#

it'll be easier if you just made the age-of-production repository now

sand moss
#

ill do that then

#

do i follow the same process or do i have to do something different

tall cedar
#

the same way will be fine

sand moss
#

alright

#

done

tall cedar
#

oh hang on looks like your mod's name on the portal is with uppercases

sand moss
#

im aware

#

thats why i named it Age-of-Production

tall cedar
#

does your git repo have uppercase too?

#

excelent

sand moss
#

like the folder its in

#

i already dealt with this

#

me and my love for uppercase smh

tall cedar
#

so the next step, rename your current Age-of-Production mod's folder to Age-of-Production-old

sand moss
#

done

tall cedar
#

now in the github desktop application search for the repo and press clone

#

set the "local path" to your factorio mods folder

sand moss
#

alright

#

clone?=

tall cedar
#

yes

sand moss
#

alright

#

got it

tall cedar
#

do you now have both a Age-of-Production and a Age-of-Production-old folder?

sand moss
#

mhm

tall cedar
#

allright, now drag all the contents of the old folder into the new one

sand moss
#

mhm

tall cedar
#

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

sand moss
#

yeah

tall cedar
#

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"

sand moss
#

what

tall cedar
#

enter "any text" in the Summary (required) field

sand moss
#

ok then?

tall cedar
#

commit to main

#

and afterwards near the top there should be a "push origin" button with a number beside it

sand moss
#

ok and?

#

because i accidentally clicked it

tall cedar
#

that'd be a good thing

#

could you send me a screenshot of the application? i feel like something didn't quite work

sand moss
tall cedar
#

ah i see, its simply so big that the initial push is taking several minutes

sand moss
#

the pushing finished

sand moss
#

anyhow

#

whats next

tall cedar
#

-# sorry for everyone else following along now or in the future, its not exactly a clear tutorial trianglepupper

sand moss
#

why are there 2

#

๐Ÿ˜ญ

tall cedar
#

because you named your licence LICENCE.txt

#

the convention is to have it without the extention

sand moss
#

ok i deleted it

#

gone

tall cedar
#

now in the summary field type "Deleted duplicate licence", commit & push

#

or if you deleted it from the github site, then press pull

sand moss
#

i just commited the change like github automatically named it

#

from the site

#

its done

#

what now

tall cedar
#

pull

sand moss
#

?

tall cedar
#

at the top under repository, there should be a pull button

sand moss
#

on the site or on the desktop?

tall cedar
#

desktop

sand moss
#

ok done

tall cedar
#

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)
sand moss
#

alright

#

guess we'll try that now

#

do i delete the -old folder?

tall cedar
#

the old folder should be empty now anyways, so yes

sand moss
#

and also
i head there was a thing to directly upload stuff from the repository on the factorio site
yk how to do that?

tall cedar
#

that would be the fmtk vscode extention

sand moss
#

do you know how to set it up?

#

and stuff?

tall cedar
#

i haven't really played around with it yet, i wrote my own upload script

sand moss
#

i should already have it

#

just havent got to using it

sand moss
#

@tall cedar so about the surface limit?

tall cedar
#

now that you've added the project to git i can start writing some code for it

sand moss
#

yeah

tall cedar
#

i'll get back to you later today

sand moss
#

gotcha

#

thanks btw

languid reef
tawdry jay