Reputation: 293
How do I pull down the latest updates from a git repository and not mess up the files I modified? And I don't want to mess up anything on the author's git repository either.
Suppose there is a security application someone has written and shared on git..
I run git clone https://applicationurl.git
and download it.
I modify the config file to work on my network.
So months later when I hear there's an update I run git status
and get ...
Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory)
modified: elastalert/config.py
which is the file I modified from the original. BUT if I do git add I'm not messing up anything on the author's git page?
Just to get it to work I just cp'ed it to home, deleted the file, and then ran
git pull
copied the file back over from home and now it's good to go.
BUT how do I do this the 'git' way? I'm still a novice at this and don't want to mess up the author's original code in git.
How can I make changes to a config file and still get the latest updates from the repository?
Many thanks...the git documentation makes my head spin.
Upvotes: 1
Views: 46
Reputation: 312008
I'd create a branch and commit your local changes:
$ git checkout -b myconfig
# edit config.py
$ git add elastalert/config.py
$ git commit -m "My Configuration"
Once you have that, you can pull (or fetch and rebase) the author's master branch:
$ git fetch origin
$ git rebase origin/master
Upvotes: 1