Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+15 votes

Will git let you push? pull? if there are remote commits that aren't in your local repo yet?
I'm unsure but I feel like it should right?

asked in CSC305 Fall 2022 by (1 point)

2 Answers

+11 votes

Git won't let you push in this case, because the remote repo is ahead of your local repo.

Git will let you pull (as long as you don't have untracked local changes that would be overwritten by the pull).

After you have pulled (and merged conflicts if necessary), then you would be able to push.

answered by (508 points)

What exactly do you mean by "Untracked local changes"?

+8 votes

It will always let you pull unless there are changes in your local repository that are not it the GitHub repository. In that case you may have to stash your changes, otherwise you should be able to pull without issue. If there are remote commits and that are not in your local repository, then you will need to pull again and make sure your files don't conflict with your teams and after you merge the files you can push to the remote repository without issue. Please correct me anyone if you have a different answer to this problem.

answered by (2.1k points)