Not a developer question but regular github user, keeping tools updated?

I’m not a developer(yet) BUT I do grab a lot of security tools and code that people post on github(awesome).  

If I download a tool with -

git clone ‘path to tool.git’

and then I work with a file in that folder, say a json template, a text file or something like that. 

Then, a couple months later, there’s an awesome improvement to the tool which I want so I run again - 

git clone ‘path to tool.git’    

BUT, now I get the ‘merge’ problems.  

I understand git is protecting my changes but what’s the best way to keep this updated?  

I’ve tried

‘git commit -m “my message”’

git stash

git stash pop

and almost everytime there’s problems(I’m sure it’s me). 

The easiest thing so far has just been to rename the first folder, git clone the latest, and then copy over my modified files.  

Is there an easier ‘git’ way to do this?  

Thank you and stay safe!

In principle merge conflicts happen when both you and the upstream repository have changed the same files, in ways that can’t be automatically resolved. You will have to take some kind of manual steps to resolve that. In priciple your current approach of copying your files over a fresh clone does that, too: Keep your changes, discard any remote changes to those files.

The git way to handle this would be to use branches: Create a branch for your changes and commit them to that branch. That way you get to manage your changes with git. When upstream has changes you want you then have two options:

  1. Merge the upstream branch (e.g. master) into your branch.
  2. Rebase your branch onto the updated upstream branch.

In both cases you will have to resolve any conflicts, the section of the Git Book I linked regarding merging also explains how to do that. I’d recommend reading the first three chapters to get a little more context.

Got it… thanks @airtower-luna !!