This course simply teaches what you *really* need to know about Git. After working professionally with Git for more than 5 years with large and distributed teams, I will show you, step by step and cutting out all the fat, what Git is, what’s the use case behind each feature and how you can use it effectively like most professional web developers use it.
The course starts assuming you know nothing about Git and step by step explains the theory and introduces each command, progressing in a smooth, logical flow.
At the end of the course you participate in an open source project hosted in Github where you will collaborate with other student building a worldwide restaurant guide, where you will need to apply everything you learned in the course.
Additionally, you will be able to purchase a complete book of the whole course, so that you have an easy reference to all the knowledge.
The course has more than 2 hours of video tutorials and you can also purchase a book that covers all of the video content, so that you can refer any information in a printed format.
If you search on the web, you’ll find hundreds of courses, videos and other resources about Git, but it’s work that’s incredibly tedious and leaves more questions than answers. You can also buy a “Pro Git” book and try to learn all of Git as if it was your end goal. The truth is Git is only a very basic utility tool that you shouldn’t be thinking about. You should spend your valuable time learning more productive things, like computer languages. With this course you’ll get that level of comfort, knowing you will be using Git without thinking about it.
The course is divided in 8 sections:
Also, at the end of the course, we have a collaborative project that uses all the knowledge from the course and leverages Github as a community platform.
Additionally we’re constantly updating the course constantly, adding lessons thanks to the feedback of our students.
So stop feeling like Git is something complicated. You need this tool to become a successful, professional developer. Git is not hard.
Enroll now and learn the essential Git and move on the important stuff... like coding.
Welcome to “Essential Git - Second Edition”. My name is Jorge Escobar and I have been managing development teams that use Git on a daily basis for many years and I know first hand how important it is to be fluent in this fundamental tool.
Git is a version control system, or VCS, that allows developers to improve the way they work on their code as well as collaborate easier with other developers in software development projects
There are multiple ways to install Git on each operating system. If you have Linux, Git usually comes pre-installed or just use ```apt-get install git``` on Ubuntu or ```yum install git``` on Red Hat.
Let’s check what are the best options based on your operating system, Windows or Mac.
If you have Windows 10, the best alternative to install Git is to use [Chocolatey], a Windows package manager similar to apt-get and yum on Linux.
The best wat to install Git in Mac OS is by using [Homebrew], which is a package manager similar to RedHat’s yum or Ubuntu’s apt-get..
To verify that you have Git installed, write “git” in the Git Bash (Windows) or Mac OSX terminal. You should see a list of available commands. To see what version of Git you have, just type ```git --version```.
If there is one fundamental concept that you need to understand is how Git manages its files and the stages they go through as you work on them. This “movement” between stages is called the _File Status Lifecycle_ and here’s how it works.
Now don’t worry if you don’t understand all of these stages immediately. Let’s try to picture the workflow with an actual file that we’re working on.
In this section we will start playing with Git. We’ll create a repository, check the history of the project and — very important — how to undo operations. But first, let’s learn some basic commands to navigate the file system In the terminal.
Go ahead and open your terminal (Git Bash on Windows or Terminal on Mac) and you should get a prompt ready for your commands.
Make sure you are on the testgit directory by typing pwd and confirming you are in that folder.
We are ready to initialize our first repository. So all you need to do is to type the following command:
So we’re finally ready to create a new file. Since I’m using Atom, I just write the following command to create a new file called test.txt.
So now, let’s go ahead and make a change to the file. You should still have the Atom editor open, and if not, open the test.txt file again and insert a new line Test #2 and then save it.
Ok, so now we’ll do something a bit different. We will modify our test.txt file but also add a second file to the repository. So open Atom again and add a third line to the test.txt file and save it.
As we have seen from our interactions with Git, there’s a concept of history built in as we move along in the development of the project. Each commit is like a photograph of an organism as it grows and grows.
If we want to see just the last x commits, you can pass that number after the Git log command with a dash, for example, to see the last two commits, you can do the following.
If you want to see what the codebase looked like at the time of these snapshots, you can do so by using the git checkout command.
Let’s see other useful Git commands.
There are things we want to undo after we have pressed the Enter button on our keyboard and Git allows us to undo a lot of them. Let’s see some of the ways we can undo things in Git.
So let’s say you created a new file, called bar.txt and you add it to the repository. The file is now on the Staged status, ready to be included in the next commit.
Let’s quickly review the commit process. Let’s say you have a repository with three commits. We can visualize it as follows.
Continuing with the example, let’s say that we have completed the work on the newfeature branch. We did a checkout on the branch, did one more commit, and now we need to incorporate those changes back to the the master branch. This is what we have at this moment.
Now let’s try doing these operations in our terminal. Go to your home folder by doing cd ~, create a new folder and initialize the repository.
Often you will find yourself with merge conflicts. When Git tries to merge the content of a file from two different branches where it doesn’t know exactly how to merge it, it will throw an error. Don’t worry, this is easily fixed.
There is another method to merge two branches, called rebasing. The theory behind rebasing is that your commit history is cleaner and that it appears more linear to people looking at the history. It’s a little bit like writing a book; think of merging as putting out the book with the drafts and the different corrections to the chapters, versus rebasing which looks more like a finished book with each chapter telling a story in a logical fashion.
Let’s say that you don’t want to show the two commits for the newfeature branch when we rebase into master, because the two commits are related. You can actually edit the history by doing an interactive rebase.
Git offers us a way to create special pointers called tags. Tagging is useful to mark points in your commit history that are important. Most of the times, tags are used to denote versions of your application.
Most of the times you will be working with a remote repository that you and your team are using as a pseudo centralized repository, although we already know that Git is a distributed version control system that doesn’t need a central server.
So head over to Github.com and create an account with them. Typically you’ll need to provide a username, email and password. Github is completely free for public repositories but if you want to keep some of them private, you will need to pay them a monthly fee.
The first thing we want to do is create an SSH key to be able to push and pull code from your repositories. Think of SSH as a key and lock pair that allows Github to know that you are who you say you are.
Let’s create our first remote repository. Go back to your profile, click on Repositories and then click on the green New button.
Make sure you’re in the test-remote-repo directory and do a git status. You’ll see you are in the master branch and that nothing has been committed yet.
When you’re working with a team of developers, often times they will be pushing code to the remote repository and you will need to get those changes incorporated to your codebase as you work along your own timeline.
We can also have local and remote branches. These can be pushed or pulled just like we did with the master branch.
This is the end of our Git journey. Now the only thing you need to do is play with Git and learn some of the remaining tricks it has under its hood. Believe me, I still learn a new feature every other week.
Get the course book with a special discount!
From Zero is an educational project created by Jorge Escobar, a technologist, entrepreneur and open source fanatic with more than 15 years of experience in the development of web applications in New York City.
Jorge has worked in well established companies like Yahoo!, Univision and MongoDB and has also been the technical founding member of various successful tech startups that have received multiple rounds of venture capital.
The biggest problem Jorge has experienced during his career is finding well rounded developers and he interviewed hundreds of them for positions in the teams he was leading. A constant pattern (no matter if candidates came from a good university or had a few years of experience) was the lack of practical, real world knowledge.
That’s why Jorge created From Zero, an educational project that would address those practical knowledge issues through training that builds hands-on experience and equip students with the tools required to be successful in today’s technology business needs.