I thought i had it all figured out, but one question still remains. What happens when you pull the repo, make some changes, while in the middle of this, someone else pushes to this repo? At that point you are not able to push until you pull again to update with the repo. Doesn't pulling just essentially download the repo again?

For example: At that point when you push to the repo it looks to be denied as you dont have the lastest. At this stage, i copied the work i did for backup. Then I pulled the repo again. In which it thinks there was no changes to be made. So i add an empty line to make a change. Then push it. At that point i think i did it right, for the exception in the log it did both. So if you push the repo when you dont have the latest, what the difference as it pushed it anyways?

I mean its not a big deal. It would be nice to know. It would also be nice to not have a bunch of changes with an extra empty line as the only change, because you dont know if it pushed or not.

If the original repository you forked your project from gets updated, you can add those updates to your fork by running the following code:

git fetch upstream# Fetches any new changes from the original repositorygit merge upstream/master# Merges any changes fetched into your working files

What is the difference between fetch and pull?

There are two ways to get commits from a remote repository or branch: git fetch and git pull. While they might seem similar at first, there are distinct differences you should consider.Pull

git pull upstream# Pulls commits from 'upstream' and stores them in the local repository

When you use git pull, git tries to automatically do your work for you. It is context sensitive, so git will merge any pulled commits into the branch you are currently working in. One thing to keep in mind is that git pull automatically merges the commits without letting you review them first. If you don't closely manage your branches you may run into frequent conflicts.

Fetch & Merge

git fetch upstream# Fetches any new commits from the original repositorygit merge upstream/master# Merges any fetched commits into your working files

When you git fetch, git retrieves any commits from the target remote that you do not have and stores them in your local repository. However, it does not merge them with your current branch. This is particularly useful if you need to keep your repository up to date but are working on something that might break if you update your files. To integrate the commits into your local branch, you use git merge. This combines the specified branches and prompts you if there are any conflicts.