
This video provides an overview of the entire course.
Learn what Version Control is as a concept, what it is used for, and why it can be so useful for software developers.
Overview of Version Control as an abstract concept
Look at an outline of Version Control’s major benefits
Explain why Git is our chosen VCS system
Learn how to install Git on your machine, be it OS X or Windows.
Download the installer for your operating system
Run the installer
Configure Git on your machine
The terminal is a text-based interface to our computer and operating system. It will be the primary method of interaction with Git in this course.
Explain the reasons for using the terminal
Outline the terminal’s capabilities for OS interaction and control
Handle “falsey” expressions in an else block
Filesystem navigation is one of the most important skills to have when using the terminal. Navigating to different folders and listing their contents is a fundamental part of most terminal usage.
Navigate between different locations in the filesystem
List the contents of directories
View help files for terminal commands
Consider the following: creating a folder, moving a file or folder to a different location, copying a file, renaming a file, or reading its contents using a few simple commands. These operations can be very useful if you want to make some quick changes to your filesystem without using your file explorer.
Learn about various file and folder manipulation commands
Practice the use of the commands
Vi is a very powerful command-line text editor that allows users to edit and read any text files directly from the command line.
Learn about VI as an editor
Open and edit a new file using VI
Learn how to quit VI
The git init command can be used to turn any folder on your computer into a Git repository. This will be the starting point for our Git learnings.
Initialize a repository on your computer
Observe what this command does under the hood
Tracking files is the process of telling a Git repository to track the changes made to those files over time.
Tell Git to track specific files
Learn the different stages that changes can be in
A key component of Git is viewing the changes you have made to files since your last commit. To do this, we can use the Git diff command.
Make some changes to the repo
Run the Git diff command
View the diff output
Once changes have been made in the repository, we will want to save those changes. To do this, we use the Git commit command.
Make and view your changes using Git diff
Save those changes to the repository using Git commit
Provide a useful message to the commit
There will be files in our Git repositories that we will not want to track the changes to, such as build artefacts. We can use Git ignore lists to specify these files.
Decide what files are to be ignored
Create a .Gitignore file in the repository
Write an expression to match the filenames of ignored files
The main focus of Git is to track changes to files over time. To view all changes committed to a repository over a certain time period, we can use the Git log command.
Open a repository that has been committed to
Use Git log to view all changes
Pass arguments to filter the log to your liking
Sometimes when programming, we introduce bugs that break the software we work on. Git can be used to easily revert the change that broke the program.
Identify the commit to be reverted
Use Git revert to undo the mistake
Commit the revert
We won’t always start the projects we work on from our own machines. To begin working on an existing repository, we can clone the repository using Git clone.
Get the URL of the repository you want to clone
Clone it to your local machine
Start working on your clone of the repo
In order to share work with other programmers, we need to send to and pull changes from remote repositories. We can manage our repositories’ remotes using the Git remote command.
Use Git remote to show our configured remote repositories
Add or remove remotes
Fetch and merge changes into your local repository
Sometimes we might want to designate a certain commit as one of significance, for example, a certain released version. We can do this using Git tags.
Add tags to certain commits with messages
Push the tags to remote repositories
Show the commit a tag points to
Branches can be used to enable parallel, simultaneous workflows in a single repository.
Learn how they are represented by Git
Learn why they are so useful
Branches can and should be used often to enable parallel workflows and allow developers to work independently in the same repo. The Git branch command can be used to create new branches.
Check out the branch you want to branch from
Use Git branch command to create new branch
Check out the new branch and begin working
Once our work has been completed on a separate branch, we will want to add that code back to the main branch of the repository. To do this, we use the Git merge command.
Check out the branch you want to merge into
Use the Git merge function
Commit the changes to the repo
Sometimes, automatic merges will not be possible due to changes having been merged into the repository that our changes conflict with. To fix this, we need to follow the conflict resolution workflow.
Initiate the merge process using the Git merge command
Manually choose which changes to merge into the master branch
Commit the resolved merge changes to the repository
When working with remotes, we need branches that track their equivalent branch on the remote repo. These are called remote tracking branches.
Create new branch on the local repo
Push the branch to the remote repository
See other collaborators fetching your branch and track it
Sometimes we will want to incorporate new changes from the branch we branched from into our feature branch. To do this, we can use the Git rebase command.
Check out the feature branch to rebase
Use the Git rebase command with the target branch
Continue to work with new changes incorporated into the feature branch
Sharing code repositories with others requires us to host the remote repository somewhere where it is is mutually accessible. GitHub can be used to do this.
Create a repository on GitHub
Push code to the remote repository
Have others clone and work on the repository
When contributing changes to existing repositories we may not always have write access, and may need to create a copy to work on. This can be done using forking.
Create a fork of the repository to contribute to
Create changes on the forked repository
Keep the fork up to date by adding upstream remote
When contributing to any repository, we should structure our commit messages well. This helps other collaborators understand the intention behind our contributions, and aids the “debugability” of our changes.
Use a clear structure for commit messages
Keep commits messages succinct and commits logically separate
When working on our local repository, we may make several commits that create one logically distinct contribution. Before pushing our changes to the remote, we can squash those commits into one single commit for simplicity.
Create multiple commits on the local repository
Squash several commits into one logically distinct unit
Push squashed commits to the repo
Once we have created some changes on our forked repo, we will want to contribute those changes back into the original repository. To do this, we can use a merge request.
Push local changes to our repository fork
Open a merge request with the original repository
Get the changes merged into the original repository
Sometimes, we may want to customize our Git workflow and create shortcuts for common tasks. To do this, we can create aliases in Git.
Think of the command you want to alias
Add the alias to your global Git config
Use the shorter command to save time and effort
This video will give you an overview about the course.
Our goal is to lay the groundwork by learning the fundamental Git concepts.
Discuss Feature branch workflow in Git
Discuss Distributed Development in Git
Discuss Core Git extension such as Pull Requests and Quicker Release Cycle in Git
Our goal is to install Git and verify the installation.
Download Git
Install Git
Verify Git installation
Our goal is to configure author and email for the repository globally and learn repository initialization techniques.
Configure author and email
Initialize an empty repository
Initialize repository with existing unversioned artifacts
Our goal is to learn the "git add" and "git commit" commands.
Adding artifacts to the index after making changes to untracked files
Committing changes to Git database
Executing an express commit for tracked files
Our goal is to learn what’s happening under the hood for git add and git commit steps.
Checking repository status before making any changes to the repository
Checking repository status after staging changes
Checking repository status after committing changes
Our goal is to learn how to peek into the commit history of a Git repository
Checking commit history in an unformatted state
Checking commit history in a formatted manner for a single file and multiple files
Checking commit history constrained by a range of commits and a defined number of commits
Our goal is to provide an overview GitHub. We will discuss basic operations such as home & landing page of GitHub website, sign ups, profile settings and creation of bare bones repository.
Here we discuss signup and sign-in with a basic intro of the landing and home page
Here we discuss and create a basic GitHub repository
Here we discuss profile settings and the structure of the repository page
Our goal is to introduce the concept of forking a GitHub repository and actually undergo the forking process.
Here we discuss the concept of forking on GitHub
Here we discuss the fork interface.
Here we actually undergo the forking process and related metrics
Our goal is to introduce the concept of cloning a GitHub repository and actually undergo the cloning process.
Here we discuss the concept of cloning on GitHub
Here we show how to clone a public GitHub repository directly
Here we show how to fork a public GitHub repository and then clone the same
Our goal is to introduce the concept of pull and push operations in a local repository in tandem with a synchronized GitHub repository and actually undergo the pull and push processes.
Here we discuss the concept of pull and push operations
Here we show how to execute a pull command
Here we show how to execute a push command
Our goal is to introduce the concept of fetch operation and demonstrate the difference between pull and fetch operations.
Here we discuss the concept of fetch operation
Here we show to how to execute a fetch operation
Here we show how to execute a simple merge command after a fetch command
Our goal is to provide a quick and powerful introduction to the world of Git branches and merging tactics.
Explain what Git branches are and their importance
Create a Git branch and display existing branches
Discuss a typical real world Git branching model
In this video, we discuss Git commands that can be used in daily management of Git branches.
Demonstrate how to checkout or switch to another Git branch
Demonstrate how to delete a Git branch
Demonstrate how to rename a Git branch
Here we discuss and implement the simple branch merging technique called fast-forward merge.
Create a branch and make few commits
Checkout back to master branch and perform a diff
Merge the new branch into master branch using fast forward
In this video, we discuss and implement the branch merging technique called no-fast-forward merge.
Create a branch and make few simple commits
Checkout back to master branch and perform a diff
Merge the new branch into master branch using no-fast-forward technique
In this video, we discuss and implement the branch merging technique called 3-way merge.
Create a demo branch and carry out few changes in the branch
Checkout back to master branch, make few commits and perform a diff
Merge the demo branch into master branch after resolving merge conflicts
In this video, we discuss and implement a pull request which is great way to collaborate in a team environment.
Demonstrate how to fork and clone a repository owned by another user
Make some changes in the cloned repository and raise a pull request
Demonstrate how a user can be given write access to merge a pull request
In this video, we will learn about Git rebase and actually implement the same.
Checkout to a demo branch
Execute a git rebase command while staying on demo branch
Checkout back to master branch and inspect the log history post rebase operation
Here we will learn how to perform a git pull with the "—rebase" flag.
Inspect the log history where remote and local repositories are not in sync
Execute a git pull with rebase flag
Execute git log command and inspect the effects of pull with rebase
In this video, we will learn how to connect and interact with a remote repository using SSH protocol.
Generate SSH keys, public and private
Add the public key to remote repository on GitHub
Perform few setup operations and synchronize remote and local repository using SSH
Here we will learn some basic file management operations which are extremely useful to carry out our daily version control related tasks.
Perform a file deletion operation for tracked and untracked files
Perform file renaming and moving operations for tracked files
Perform undo operations for staged and modified files
In this video, we learn two very popular tools, SourceTree and Bitbucket and connect both the tools.
Create a BitBucket account and perform an initial commit
Download and Install Source tree and connect with BitBucket
Perform basic git operations such as staging, commit, pull and push to sync remote and local repositories
Here we will learn the git commands that can help us to debug our code base in the repository.
Execute "git grep" command to perform string search
Execute "git blame" command to track a faulty committer
Execute "git bisect command to pinpoint a buggy line of code.
In this video, we learn some of the important best practices to be observed while working with Git.
Learn the best practices to be followed while doing git commits
Learn the best practices while performing git branch and merge operations
Learn the several bad practices to be avoided while working with Git
As a software developer, it is important to understand Version Control and how it can help your development efforts.
Illustrate the dynamic nature of writing software and simple approaches to manage change
Explain the importance of managing source code with a Version Control (SCM) system
Describe and highlight the differences between Centralized and Distributed types of systems
Using Nitrous.IO provides access to the latest version of Git from anywhere at anytime; regardless of the computer used.
Create a Nitrous account
Log in to the Nitrous box, Git is already installed
Verify the version of Gitthat is currently active in Nitrous.IO.
Verify the presence of Git and its latest version
The latest version of Git is always present on Nitrous
Verify your Git installation
Global parameters in Git are applied to every activity for the user on the computer.
Setup Global parameters in Git for the User Name and User e-mail
Verify the Global parameters in Git
Most developers who are new to Git fall into a standard pattern of use. There are many ways to use Git that can make your workflow more efficient.
When first learning to use Git, the simplified workflow quickly becomes a habit
This workflow is effective but leaves room for improvement
It is important to understand how changes are 'staged' in Gitin order to be added to a commit.
The Git 'add' command instructs Git to watch for changes in these files
Git tracks changes to all files
Learn how to move files in and out of the staging index
The commit is pivotal to Git as a Source Control Management system. Understanding the GitCommit will broaden your understanding of Git in general.
Examine the Commit
Explore the details of the Commit and see how they relate to the directories in the previous subsection
There is no magic in Git. It uses the file system with a set of hidden directories that store the information.
Examine the hidden Git directory
Investigate and explore the purpose of the contents of these directories
When exchanging Git repositories (and updates), you need to connect to other computers.
Connect to a service such as GitHub to retrieve a Git repository
Set the URL to Pull and Push a Git repository
Protocols used and authentication ‘required’
When working on a project with others who may be making changes in parallel with you, it is important to keep your copy of the Git repository synchronized.
Connect to a remote Git repository and the concept of 'tracking branches' to help synchronized
Software development rarely runs on a straight and smooth course. Quite often, there are interruptions to the flow of development by 'other' development tasks or emergencies on the same project. Branching is the way to maintain a sense of continuity in the mayhem.
An example of “typical” software development work and interruption
The most common way to divert development efforts from a main task to a divergent one without losing continuity
Git applies a unique approach called “lightweight” to source control branching.
By applying your recent understanding of the internal workings of Git, we can see how Git approaches development branches.
Implementing the ‘feature’ branch
Understanding more about Git History.
Overview of Git History
How it represents decisions made along the way in the life of a project
Learn how to 'phrase' commit messages that carry the most information.
Review the commit message and its role in a Commit
A debate of the “tense” to use with commit messages
recommendation the best of both sides of the debate
Working in parallel is useless unless you can “bring it all back together” to ship it.
Review Git's branching model
Explore merging strategies
A few “edge cases” regarding merges
What to do when you make a mistake.
Examine the Git reset and repercussions of using it
Look into the revert and rebase functions
If we accept that the history is a story of your project, you may need to alter that history to tell the story better.
Examine ways to modify the Git history
Merging brings changes together but can leave a messy history.
Try out an example to show how rebase works
Create a new branch and a new file in it
Perform the rebase
Sometimes, you need to know who last changed a file and when.
purpose of the Blame command
Use the “s” switch
Since Git manages change, it is important to be able to view those changes as differences over time.
How is Diff different from Blame
Use Diff in our earlier 'explore' project
Finding where a bug was introduced in the code can be an impossible task. Git has a tool that acts like your private detective for this.
Locating where and when a change took place is difficult in a large history of changes
Bisect will perform a binary search with your guidance and pinpoint that location for you
The patch is a small, lightweight way to distribute updates.
Although antiquated and used infrequently, the patch is handy to understand.
Often, you need to access other software, such as libraries. How do you do this without cluttering your repository?
Include other Git repositories within your project as independent modules
How to deal with the tricky parts of SubModules
Often, during our work as software developers, an ‘urgent change’ forces an interruption in your workflow. Git has a provision to “put aside” your current work temporarily.
Go back to our ‘Packt’ project for some practice
Merge the text from branching.txt into the README file
Save the state of our work here
Since Git is a command-line utility, there is a demand to do a lot of typing. Many common commands, although short, can include a complex set of options, making the typing tedious and error-prone.
Discover Git’s alias feature
Learn how to add, edit, and update alias commands
Develop a 'library' of favorite Git alias shortcuts
Discover the most common GUI clients for Git
There are a few common troubles many developers face when using Git. Armed with a new understanding of how Git works, these can be easily overcome.
Examine few common problems and suggested solutions
Resolve problems with Push and Pull
Update commits that are already in the history
Throughout this presentation, we have been making notes and ideas for reference as you continue to expand your experience with Git.
A Git repository that contains all the information revealed up to this point
Using this information, merge it with your own notes in order to use it as a personal study guide
Any learning is a process that should continue throughout your lifetime. This is no exception.
Ideas, resources, and encouragement to continue growing and stretching your skills with Git
Changes in the long-awaited Git 2.0 release
Finally, an invitation to become a “Gitizen” (a member of the elite group of expert Git users)
Learning is a lifetime process, and your expertise with Git should continue to grow.
A few additional and advanced tricks and techniques
Resources to learn more and gain a deeper understanding of Git
Special acknowledgements and thanks from the author
Three complete courses in one comprehensive training program.
Using Git, you can track the history of file and code changes, deliver new versions of software without relying on any continuous delivery mechanisms, and protect your code from any mistakes made while programming! Git version control gives developers the capability to manage, version, release, and share a code base, free from the nightmare of breaking code. With an enhanced workflow and a faster release cycle, it makes agile software development much easier. Controlling your projects—small or large—is easier now, owing to the advanced functionalities that Git brings with it. It will help you implement that perfect workflow you have been looking for!
This comprehensive 3-in-1 course is an easy-to-follow guide full of examples to help you gain knowledge and expertise in Git. To begin with, you’ll learn how to create, contribute to, and collaborate on software projects using Git. Set up Git repositories, clone an existing repository, and work with local and remote branches and tags. You’ll also manipulate and change the Git commit history, to tackle practical workflow problems. Integrate external software into your project without affecting your app, with the help of SubModules. Finally, manage your projects with the aid of hands-on exercises that make Git version control easy for you!
By the end of the course, you’ll learn versioning and manage your code to deliver projects with better performance using version control with Git!
Contents and Overview
This training program includes 3 complete courses, carefully chosen to give you the most comprehensive training possible.
The first course, Learn Git in 3 Hours, covers building powerful and effective projects using Git Version Control Systems. In this course, we’ll teach you the basics of using Git and explain how it works. To begin with, we’ll show you how to install Git and effectively use your computer’s terminal or command line to navigate the file system and create and edit files. Then we’ll cover all the commonly used commands in Git that make up the vast majority of any Software Engineer’s workflow.
Moving on, we’ll explain Git’s branching workflow, why it’s such a useful feature, and how to use it in your projects. Once you’ve learned all this, we’ll discuss some advanced Git workflow techniques that will make you a valued contributor and collaborator on any project. You’ll be able to create your own Git repositories or clone and contribute to existing ones. This will allow you to track the changes to sets of files over time, recover data you might lose, and collaborate with others on projects. You’ll have a profound understanding of Git’s branching workflow, and how to use it in the best possible way in your projects. By the end, you’ll be familiar with using Git and use VCS to handle large projects easily and make well-crafted contributions to your own or others’ projects.
The second course, Hands-On Version Control with Git, covers better project workflows with Distributed Version Control. In this course, you will learn how to use distributed version control to record changes to the project file system to optimize workflows. Git is a highly sought after skill when it comes to landing a programming job. However, Git can be pretty useful even to non-programmers such as designers, authors, and so on. You'll learn how to configure your environment to use Git, exploring the inbuilt tools for migrating without losing code files. You'll explore the Git data model and how you can navigate through databases with simple commands. You'll debug your application with Git and use various techniques to find faulty commits. You'll also learn to go remote with your repository with GitHub, updating and cloning remote repositories. Then you'll set up your repositories in BitBucket cloud. You will set up your own Git repositories, configure access, find and recover from repository errors, and perform repository maintenance and troubleshooting. Finally, you will work with centralized and distributed version control systems and see how to use Git to bring order to the chaos of collaborative software development. By the end of the tutorial you'll have figured out how to use Git, mastered workflows (from basic to open source), and adopted the one that fits your needs
The third course, Mastering Git, covers managing your projects with the aid of hands-on exercises that make Git version control easy for you! This course is an exploration of solo and collaborative Source Control Management with the intention of expanding and improving your confidence and expertise with Git. You’ll begin with a brief overview of Source Control Management before setting up and verifying your Git installation. Then, you’ll move on to a more detailed look at the Git workflow and explore variants and the not-so-rare “special situations”. With a strong understanding of the Git history and structure, you’ll learn how to use power tools as Branching, Merging, Reset, Revert and so on. Next, you’ll take a deep dive into more intriguing features of Git such as Rebase, Stash, Aliases, and Patches. You will explore several examples of these commands to improve the efficiency of using Git. Finally, when you have mastered the various tools provided by Git, you’ll be provided with some suggestions that’ll help you to move forward with Git. Once you are done with this course, perhaps you will be the one providing answers to others in trouble!
By the end of the course, you’ll learn versioning and manage your code to deliver projects with better performance using version control with Git!
About the Authors
● Ross Conyers is a Computer Science Graduate and Software Engineer who started programming and building computers in his teens and went on to study Computer Science at the University of St Andrews. When he started programming, he worked with web technologies and Java. During his degree, he focussed on network programming and have developed a love of all things. Throughout his work, he did programming mostly in Python, working on high traffic, data-intensive, distributed systems that are used by millions of people per day. He believes to share some of his knowledge gained within several years.
● Bibhash Roy is a hardened Software Developer and Professional turned entrepreneur, with over 25 years of rich industrial experience (17 years in Software Development) in diverse fields. However, he is passionate about teaching whatever he has learned in his career, spanning an array of prestigious stints at large Global Corporate powerhouses such as PricewaterhouseCoopers and Siemens. Over the years, he has gained deep knowledge and expertise in programming languages such as Java, C, C++, PL/SQL, Scala, and Python to name but a few. He has worked extensively in various frameworks and tools such as Spring, Struts, Hibernate, Oracle, MongoDB, Cassandra, Hadoop, Spark, and others. DevOps intensely interests him. He has been working with Git and GitHub since their inception. As a part of his engineering responsibility, he has developed and architected numerous highly scalable and mission-critical applications for many Fortune 500 companies. Currently, in the role of founder and CEO, he is spearheading Whitepeak Software, a cloud-based software development company deeply involved in domains such as big data, mobile, and the Internet Of Things (IoT)!
● Thom Parkin has been writing software since the days when all phones had wires. A self-proclaimed ParaHacker, Thom immerses himself in technology both professionally and as a hobby, spending his free time participating in the world of open source software. When he is not playing euro board games, he is writing software or writing about software development.