Learn Git in 20 minutes

preview_player
Показать описание


In this video we're going to learn the basics of Git in about 20 minutes.

0:05 - Initializing a repository, adding, and first commit with a message. Git is a powerful tool to help you manage versions of your project, work with other developers, undo unwanted changes, and much more. This section gets us up and running with git so we can add our first "commit" or a first "checkpoint" for the project.

3:31 - git diff allows you to see the differences of each file between now and the last commit. The removed content will show in red, while the additions will be shown in green. It will show you which files are new, and which files have been deleted also. You can easily "discard" changes at this point to revert back to the state of the project at the most recent commit.

5:36 - Discarding changes with git restore. In this section we show you how to discard changes so you can revert a file (or files) back to the state at the last commit. We do this once in visual studio code (our text editor) and again in the terminal with "git restore filename". Discarding changes in Git is cool because you can "discard" deletions of a file, which means the file will be "un-deleted". You can "discard" the creation of a file which means the file will be "un-created". Discarding in git means reverting back to how things were.

7:14 - Git Branch (I messed up off screen so I need to delete and re-initialize the git repo before proceeding). Git branching allows you to create a separate "version" of the project so you can work on a branch, bug fix, etc. in a somewhat isolated environment. New changes in one branch will only be in that branch. When you're ready you can either "merge" the changes into another branch or discard the branch, or just leave it there for later use.

10:07 - Merging changes from one branch to another in Git. (Relies on previous section "Git Branch".

10:55 - Git Merge Conflicts happen when two changes conflict with each other. This can happen when one developer deletes a file, and another developer adds content to that same file that was deleted in a separate branch, and they both try to merge these changes into the same branch.

17:53 - Git merge & Git Rebase. Updating a branch when it's behind the default branch can be done in a variety of ways. The simplest method is to simply merge. So we'll do that in this section.
Рекомендации по теме