How to merge in git changes in the script that were uploaded but not pulled in my version?


So, I have a project where me and a colleague work both in the same script.
She already made some changes and uploaded to git. I have also done other things in the script and I now I would like to push also to the repository.

However, I am afraid the one of 2 things happen:

1- I pull her changes and I loose all my updates in the script.

2- I push my changes and I could get an error because the version is not the most recent one / or her changes are discarded.

What is the best way to deal with this type of co-working?


That scenario is why we have git.

  1. Pull changes from repository

  2. git will recognize that you’re merging changes and will show you which parts of code were changed

  3. git will offer you options to accept incoming changes, keep your version of the code or decline incoming changes. it is up to you what you’ll do with every part.

  4. you can continue working on script

  5. commit it and push to repo for others to see your changes

they will go back to step 1 and repeat the process.

If you’re afraid your changes will disappear you can stash your changes or just copy your script to another folder until you’ll gain confidence in working with git.

Answered By – GregL

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published