Question

I am new to git tortoise, and I have a few question from the training I received on git tortoise.

I was told to always do a git pull right before push. However, if I make some changes to the code on my local drive, then commit, then do a pull right before push.

How is this pull gonna interact with the changes I just made? Would it overwrite my changes? What is the mechanism here? Is there an option to set up whether the action would overwrite the code or not?

Also, let's say someone else also made changes to the same file and have already updated the code in the central repository.

What would happen this time if i do the git pull?

Was it helpful?

Solution

If you commit locally and your remote hasn't been changed. Git pull will return information that your repository is up-to-date.

If somebody pushed some changes and you don't have them locally git won't let you push. You will have to merge these changes to your local repo - and for the most part git pull will do that (in cases when two or more different commits change the same code there may be conflicts that you will have to resolve manually)

Also it's worth noting that it actually requires some effort to loose something permanently in git.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top