How to manage my greasemonkey accounts using Git (so that they are hosted on GitHub)

I would like to use Git to facilitate the development of my accounts (21). In addition, I would like them to be hosted on GitHub. (using Greasemonkey with Firefox on Windows 10).

So my question is: what is the way to manage my accounts with Git so that they can be hosted on GitHub?

  • save a separate folder (for example, c:\my_scripts , which will be my repo folder) containing copies of my user script files ,
    that is, every time I change one of my usercript files (located in gm_scripts )
    gm_scripts\script_subfolder I have to manually copy it from gm_scripts\script_subfolder to my_scripts ?

  • have all my user user scripts in the same separate folder (my repo folder),
    and link them to the gm_scripts folder (using mklink symbolic links in the .bat file), as I read in this answer ?

  • only create one repository containing my gm_scripts content ?
    (inside gm_scripts , besides my 21 user scripts, I have many other scripts installed that I will have to include in my .gitignore file).
  • or is there a better way i miss ?

I noticed repositions of two authors of many user scripts: @Mottie and @jerone, which have many accounts hosted on GitHub, but they follow different approaches:
Mottie userscripts are all in the root repo folder (only .js files, no subfolders) , ( screenshot )
and jerone userscripts are each located in their own subfolder in the repo ( screenshot ).

I assume that Mottie has all of his user scripts in the same separate folder (which is the repo) and has gm_scripts associated with the folder,
while jerone either just saves a separate folder as a repo, with copies of its scripts,
or has its own repo containing gm_scripts folder (but jerone .gitignore does not contain entries for these files in gm_folder that should be ignored, for example .db , .wal , .shm , config.xml , etc. Therefore, I'm not sure This is true).

+5
source share
1 answer

I (the user above called @jerone ) actually has two folders that I keep in sync: the GreaseMonkey gm_scripts out repo folder in another place.

The current folder structure on GitHub exists because I wanted to back up my scripts, immediately before Userscripts.org, when disconnected. So I just copied my scripts (with folders) from the gm_scripts folder. Also, since I used to use several @require , storing them in the appropriate folder.

I did not gm_scripts my gm_scripts folder to git due to the use of git branches for each user name. One of the reasons is the problem of redistributing branches with the last master. Another reason is that you cannot work with two branches of functions at the same time.

When working with a patch or new feature, I work in the gm_scripts folder. When I'm happy with the changes to live postscript, I use WinMerge to sync the changes to my checkout repository folder before making changes.

.gitnore is a .gitnore file because I used Visual Studio to update the script, but I changed to Atom a long time ago.

+3
source

All Articles