Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
The course shows how to use Git, the popular open-source version control software, to manage changes to source code and text files. Using a step-by-step approach, author Kevin Skoglund presents the commands that enable efficient code management and reveals the fundamental concepts behind version control systems and the Git architecture. Discover how to track changes to files in a repository, review previous edits, and compare versions of a file; create branches to test new ideas without altering the main project; and merge those changes into the project if they work out. The course begins by demonstrating version control in a single-user, standalone context, before exploring how remote repositories allow users to collaborate on projects effectively.
In this movie we are going to talk about what happens when you try to push to a remote server that has been updated. Here is the situation that I'm talking about. Imagine that we have our remote server and our local repository and both of them have three commits in it. We do a fetch, so we know that we are completely in sync, we just have these three git commits. So once I know that I am in sync, I start my work for the day. And over the course of the next hour I put together a commit. I then commit it to my local repository. At the same time though, my coworkers and collaborators have also been making commits and they've been pushing their commits up to the remote server.
So now when I try to push my commits to the remote server, the remote server says, well, I don't know what to do with your commits, there has been some new stuff that's come in in the meantime. Git never tries to do a merge during a push. Instead what Git says is, some new stuff has come in. I'm not sure what to do about all this. You need to fetch the changes that are on the remote server, then sort it out on your end and come back and try again. So we do a fetch. We've got the new information about what's on the remote server, we now see why there's a problem, oh, there were some other commits there.
But that doesn't solve our problem. We've still got to merge our changes in with those. This is not just because there's a conflict, it's not because I changed Line 37 of index.html and someone else changed Line 37 of index.html, it's just simply because there were new commits. So what we need to do in this case is git merge origin/master, that will then merge my changes in with origin/master and create a new merge commit, and then I can push again and the remote server will accept it.
If there were merge conflicts, I would need to fix those just like we do with the normal merge conflicts. But in most cases you don't even get conflicts, you just simply have to do the merge in order to send it to the remote server. So just keep that in mind, if you can't push the remote server, you'll just need to fetch, then merge, then push again. That way we can make sure that everyone's changes are taken into account.
Find answers to the most frequently asked questions about Git Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.