Git Tutorial - The Ultimate Guide

Git Tutorial – The Ultimate Guide

Deal Score+1

Delve into the world of Git version source control with this compact guide that discusses the features of this popular control system! Download Git Tutorial – The Ultimate Guide Ebook Now!

Git is, without any doubt, the most popular version control system. Ironically, there are other version control systems easier to learn and to use, but, despite that, Git is the favorite option for developers, which is quite clarifying about the powerfulness of Git.

Table of Contents

Table of Git Tutorial – The Ultimate Guide Contents

1 What is version control? What is Git? 1
2 Git vs SVN (DVCS vs CVCS) 3
3 Download and install Git 4
3.1 Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.2 Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4 Git usage 6
4.1 Creating a repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.2 Creating the history: commits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.2.1 Tips for creating good commit messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3 Viewing the history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.4 Independent development lines: branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.5 Combining histories: merging branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.6 Conflictive merges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.6.1 Knowing in advance which version to stay with . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.7 Checking differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.7.1 Interpreting the differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.7.2 Differences between working directory and last commit . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.7.3 Differences between exact points in history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.8 Tagging important points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.9 Undoing and deleting things . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.9.1 Modifying the last commit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.9.2 Discarding uncommitted changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.9.3 Deleting commits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.9.4 Deleting tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5 Branching strategies 20
5.1 Long running branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2 One version, one branch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.3 Regardless the branching strategy: one branch for each bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Git Tutorial iii
6 Remote repositories 24
6.1 Writing changes in the remote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.2 Cloning a repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.3 Updating remote references: fetching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.4 Fetching and merging remotes at once: pulling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.5 Conflicts updating remote repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.5.1 A bad way to resolve conflicts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.6 Deleting things in remote repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.6.1 Deleting commits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.6.2 Deleting branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.6.3 Deleting tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
7 Patches 28
7.1 Creating patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7.2 Applying patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8 Cherry picking 29
9 Hooks 30
9.1 Client-side hooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
9.2 Server-side hooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.3 Hooks are not included in the history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
10 An approach to Continuous Integration 32
11 Conclusion 33
12 Resources 34

Git has become the de-facto tool used for distributed version control. For this reason we have provided an abundance of tutorials here at Java Code Geeks, most of which can be found here: https://examples.javacodegeeks.com/category/softwaredevelopment/git/

Now, we wanted to create a standalone, reference guide to provide a framework on how to work with Git and help you quickly kick-start your own projects. Here we will cover all the topics needed to know in order to use Git properly, from explaining what is it and how it differs from other tools, to its usage, covering also advanced topics and practices that can suppose an added value to the process of version controlling. Enjoy!

In this guide, we will cover all the topics needed to know to use Git properly, from explaining what it is and how it differs from other tools to its usage, also covering advanced topics and practices that can suppose an added value to the process of version controlling.

With this free eBook, you will also receive weekly news, tips and special offers delivered to your inbox courtesy of Java Code Geeks.  After reading this guide, if it’s your first time with Git, you will probably be thinking how couldn’t you live without Git until
today.

Additional Information

File Type

PDF

Language

English

Reviews

0.0
0
0
0
0
0

Be the first to review “Git Tutorial – The Ultimate Guide”

Your email address will not be published. Required fields are marked *

There are no reviews yet.

Related Products

Git Tutorial – The Ultimate Guide
Download Now!
TheGazebook - Free Ebook Downloads
TheGazebook - Free Ebook Downloads

Send this to friend