Page 1 of 1

Git as sync mechanism

Posted: Mon Sep 04, 2017 1:58 pm
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

Re: Git as sync mechanism

Posted: Mon Sep 04, 2017 7:46 pm
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?

Re: Git as sync mechanism

Posted: Mon Sep 04, 2017 9:21 pm
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.

Re: Git as sync mechanism

Posted: Thu Sep 14, 2017 1:14 pm
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

Re: Git as sync mechanism

Posted: Thu Sep 14, 2017 7:10 pm
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…

Re: Git as sync mechanism

Posted: Thu Sep 21, 2017 2:34 pm
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