Ignoring a specific line in my python code while git pull and push

Hello All,

I have a repo in my Github account, that contains all the different libraries that I require to run my main script, out of all the libraries, there is one library which requires a unique ID for all the different instances I clone the repo to. But as soon as I make any changes to the repo, it changes the ID to a common one in all the clones when I do git pull. Is there a way to ignore updating one line that contains the ID in my python script while GitHub updates my complete repo?

I am kind of new to Github so excuse my wordings or knowledge, I am trying to learn it as much as I can.

Thank you in advance to each and every one.

If that ID is for each location that uses your code it probably shouldn’t be part of the repository at all.

I’d make the script read the ID from a separate file, and keep that file out of the git repository. If you’d like to have the ID file in the same directory as your code, you can add it to a .gitignore file to make sure you don’t accidentally commit it.

1 Like

Thank you @airtower-luna

Looks like that is the best solution, I will keep the ID in a separate file and outside the GitHub repository. That will make things more streamlined and better.

I am new to GitHub and hence it is a learning curve for me.

1 Like