Git as sync mechanism

Ideas for cool stuff in the future.
Post Reply
matfil
Posts: 12
Joined: Thu Aug 19, 2010 11:00 am

Git as sync mechanism

Post by matfil »

I created git repo in my tomenet/lib/user/ directory
It allows me to keep records of changes in my macros.
I also cloned it to my second computer. This way I'm keeping my macros synchronized. It'd be nice to integrate git client with tomenet macro menu to allow quick add, commit and push
My currently active ToMENet characters:
Slash, Flame, Robber, Missle
User avatar
tangar
Posts: 1652
Joined: Tue Mar 03, 2015 3:49 pm
Contact:

Re: Git as sync mechanism

Post by tangar »

Interesting idea. I'm not really familiar with git (know that there are loads of open source projects, thats it), how does your stuff looks like?
Tangar's tileset, addon, guides & maps: English TomeNET page ||||||| Russian TomeNet page
http://youtube.com/GameGlaz — streams in English // http://youtube.com/StreamGuild — streams in Russian
My chars @ angband.oook.cz
matfil
Posts: 12
Joined: Thu Aug 19, 2010 11:00 am

Re: Git as sync mechanism

Post by matfil »

Lets start with basics. Git is 1 of the most popular VCS (version control system). Its open source, so its free.
To synchronize files I had to set up repository 1st

Code: Select all

git init
git remote add <remote name> git@github.com:<user>/<repo_name>.git
git add *
git commit -m "initial commit"
git push -u <remote name> <branch name>
explanation
git init - initialize local repository here
git remote add <remote name> - set up remote repostory (<remote name> can be anything you like, but 1st remote is commonly named origin)
You can use any git serviceor even your own server to keep your remote. (Bit Bucket/GitHub offer free accounts for public repos)
git add * - all files in this folder will be tracked. (Lazy me. I track more than just macros. You can create .gitignore file to exclude unwanted files)
git commit -m "initial commit" - save state of repository (-m stands for message)
git push -u <remote name> <branch name> - Send your local repository to remote repository that you specified before and create new remote branch. I use only 1 branch and I call it master as it's my main branch. (master is typical name for main branch)
Parameters for push are needed only the first time you push branch to remote repository as you need to create branch there

every time I change something I do that:

Code: Select all

git add *
git commit -m "<date>"
git push
Then on my second computer (assuming that I cloned my repository before)

Code: Select all

git pull 
Feel free to ask additional questions. I could not include everything as I use git every day and I used to some things too much.
My currently active ToMENet characters:
Slash, Flame, Robber, Missle
User avatar
tangar
Posts: 1652
Joined: Tue Mar 03, 2015 3:49 pm
Contact:

Re: Git as sync mechanism

Post by tangar »

This is console stuff, so it works only at Linux I assume? :) Anyway, thanks for info, I'll try it one day!! :D
Tangar's tileset, addon, guides & maps: English TomeNET page ||||||| Russian TomeNet page
http://youtube.com/GameGlaz — streams in English // http://youtube.com/StreamGuild — streams in Russian
My chars @ angband.oook.cz
User avatar
tokariew
Posts: 373
Joined: Thu May 13, 2010 8:20 pm
Location: Poland

Re: Git as sync mechanism

Post by tokariew »

it work on windows too :)
you have nice git on windows program and it work like charm…
my repo with tomenet guide work on windows, for some reasons, but i lazy so i wrote script in python to make commits…
img {
max-width: 100%;
}
https://tokariew.xyz
matfil
Posts: 12
Joined: Thu Aug 19, 2010 11:00 am

Re: Git as sync mechanism

Post by matfil »

tangar wrote: Thu Sep 14, 2017 1:14 pm This is console stuff, so it works only at Linux I assume? :)
git is available on windows too.
commands are the same
My currently active ToMENet characters:
Slash, Flame, Robber, Missle
Post Reply