nfdi4plants / ARCCommander

Tool to manage your ARCs
MIT License
11 stars 9 forks source link

GitAPI v0.2 #51

Closed HLWeil closed 3 years ago

HLWeil commented 3 years ago

This PR adds the changes made in #39 to the main branch:

This PR adds the command git update -r URLtoRemoteRepo -m CommitMsg, where the -r and -m parameters are optional. This command is simply a convenience function that automatically performs a sequence of git operations to set the state of the git repo to the current state of the local arc folder. The command follows the following logic:

Iterate over all files in the repo and stage them either with git add or git lfs track based on a currently fixed size limit Stage all removed files via git add -u Perform a commit with the message passed via -m which defaults to "Update" If -r URLtoRemoteRepo is present then perform remote remove origin; remote add origin URLtoRemoteRepo If remote origin is defined then perform git pull --rebase origin master If remote origin is defined then Perform git push origin master Future improvements:

Step 1 can use an lfs filesize limit that has been specified in a config file. Step 5 can be extended to handle merge conflicts via simple (yes|no|abort) options, where yes replaces all repo changes with local changes, no replaces all local changes with the repo state, and abort resets the local state to the last local commit.

Additionally, some complementary changes were made: