Mastering Git
eBook - ePub

Mastering Git

Jakub Narebski

Share book
  1. 418 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering Git

Jakub Narebski

Book details
Book preview
Table of contents
Citations

About This Book

Attain expert-level proficiency with Git for enhanced productivity and efficient collaboration by mastering advanced distributed version control featuresAbout This Book• Set up Git for solo and collaborative development• Harness the full power of Git version control system to customize Git behavior, manipulate history, integrate external tools and explore platform shortcuts• A detailed guide, which explains how to apply advanced Git techniques and workflows and ways to handle submodulesWho This Book Is ForIf you are a Git user with reasonable knowledge of Git and familiarity with basic concepts such as branching, merging, staging, and workflows, this is the book for you. Basic knowledge of installing Git and software configuration management concepts is essential.What You Will Learn• Explore project history, find revisions using different criteria, and filter and format how history looks• Manage your working directory and staging area for commits and interactively create new revisions and amend them• Set up repositories and branches for collaboration• Submit your own contributions and integrate contributions from other developers via merging or rebasing• Customize Git behavior system-wide, on a per-user, per-repository, and per-file basis• Take up the administration and set up of Git repositories, configure access, find and recover from repository errors, and perform repository maintenance• Chose a workflow and configure and set up support for the chosen workflowIn DetailGit is one of the most popular types of Source Code Management (SCM) and Distributed Version Control System (DVCS). Despite the powerful and versatile nature of the tool enveloping strong support for nonlinear development and the ability to handle large projects efficiently, it is a complex tool and often regarded as "user-unfriendly". Getting to know the ideas and concepts behind the architecture of Git will help you make full use of its power and understand its behavior. Learning the best practices and recommended workflows should help you to avoid problems and ensure trouble-free development.The book scope is meticulously designed to help you gain deeper insights into Git's architecture, its underlying concepts, behavior, and best practices. Mastering Git starts with a quick implementation example of using Git for a collaborative development of a sample project to establish the foundation knowledge of Git operational tasks and concepts. Furthermore, as you progress through the book, the tutorials provide detailed descriptions of various areas of usage: from archaeology, through managing your own work, to working with other developers. This book also helps augment your understanding to examine and explore project history, create and manage your contributions, set up repositories and branches for collaboration in centralized and distributed version control, integrate work from other developers, customize and extend Git, and recover from repository errors. By exploring advanced Git practices, you will attain a deeper understanding of Git's behavior, allowing you to customize and extend existing recipes and write your own.Style and approachStep-by-step instructions and useful information make this book the ultimate guide to understanding and mastering Git. This book will show road to mastery example by example, while explaining mental model of Git. The Introduction section covers the 'Essentials' just for refreshing the basics. The main highlight is that the concepts are based on HOW the technology/framework works and not just practical 'WHAT to do'.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering Git an online PDF/ePUB?
Yes, you can access Mastering Git by Jakub Narebski in PDF and/or ePUB format, as well as other popular books in Informatica & Sviluppo di applicazioni. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781783553761

Mastering Git


Table of Contents

Mastering Git
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Git Basics in Practice
An introduction to version control and Git
Git by example
Repository setup
Creating a Git repository
Cloning the repository and creating the first commit
Publishing changes
Examining history and viewing changes
Renaming and moving files
Updating your repository (with merge)
Creating a tag
Resolving a merge conflict
Adding files in bulk and removing files
Undoing changes to a file
Creating a new branch
Merging a branch (no conflicts)
Undoing an unpublished merge
Summary
2. Exploring Project History
Directed Acyclic Graphs
Whole-tree commits
Branches and tags
Branch points
Merge commits
Single revision selection
HEAD – the implicit revision
Branch and tag references
SHA-1 and the shortened SHA-1 identifier
Ancestry references
Reverse ancestry references: the git describe output
Reflog shortnames
Upstream of remote-tracking branches
Selecting revision by the commit message
Selecting the revision range
Single revision as a revision range
Double dot notation
Multiple points – including and excluding revisions
The revision range for a single revision
Triple-dot notation
Searching history
Limiting the number of revisions
Matching revision metadata
Time-limiting options
Matching commit contents
Commit parents
Searching changes in revisions
Selecting types of change
History of a file
Path limiting
History simplification
Blame – the line-wise history of a file
Finding bugs with git bisect
Selecting and formatting the git log output
Predefined and user defined output formats
Including, formatting, and summing up changes
Summarizing contributions
Viewing a revision and a file at revision
Summary
3. Developing with Git
Creating a new commit
The DAG view of creating a new commit
The index – a staging area for commits
Examining the changes to be committed
The status of the working directory
Examining differences from the last revision
Unified Git diff format
Selective commit
Selecting files to commit
Interactively selecting changes
Creating a commit step by step
Amending a commit
Working with branches
Creating a new branch
Creating orphan branches
Selecting and switching to a branch
Obstacles to switching to a branch
Anonymous branches
Git checkout DWIM-mery
Listing branches
Rewinding or resetting a branch
Deleting a branch
Changing the branch name
Summary
4. Managing Your Worktree
Ignoring files
Marking files as intentionally untracked
Which types of file should be ignored?
Listing ignored files
Ignoring changes in tracked files
File attributes
Identifying binary files and end-of-line conversions
Diff and merge configuration
Generating diffs and binary files
Configuring diff output
Performing a 3-way merge
Transforming files (content filtering)
Obligatory file transformations
Keyword expansion and substitution
Other built-in attributes
Defining attribute macros
Fixing mistakes with the reset command
Rewinding the branch head, softly
Removing or amending a commit
Squashing commits with reset
Resetting the branch head and the index
Splitting a commit with reset
Saving and restoring state with the WIP commit
Discarding changes and rewinding branch
Moving commits to a feature branch
Undoing a merge or a pull
Safer reset – keeping your changes
Rebase changes to an earlier revision
Stashing away your changes
Using git stash
Stash and the staging area
Stash internals
Un-applying a stash
Recovering stashes that were dropped erroneously
Managing worktrees and the staging area
Examining files and directories
Searching file contents
Un-tracking, un-staging, and un-modifying files
Resetting a file to the old version
Cleaning the working area
Multiple working directories
Summary
5. Collaborative Development with Git
Collaborative workflows
Bare repositories
Interacting with other repositories
The centralized workflow
The peer-to-peer or forking workflow
The maintainer or integration manager workflow
The hierarchical or dictator and lieutenants workflows
Managing remote repositories
The origin remote
Listing and examining remotes
Adding a new remote
Updating information about remotes
Renaming remotes
Changing the remote URLs
Changing the list of branches tracked by remote
Setting the default branch of remote
Deleting remote-tracking branches
Support for triangular workflows
Transport protocols
Local transport
Smart transports
Native Git protocol
SSH protocol
Smart HTTP(S) protocol
Offline transport with bundles
Cloning and updating with bundle
Using bundle to update an existing repository
Utilizing bundle to help with the initial clone
Remote transport helpers
Transport relay with remote helpers
Using foreign SCM repositories as remotes
Credentials/password management
Asking for passwords
Public key authentication for SSH
Credential helpers
Publishing your changes upstream
Pushing to a public repository
Generating a pull request
Exchanging patches
Chain of trust
Content-addressed storage
Lightweight, annotated, and signed tags
Lightweight tags
Annotated tags
Signed tags
Publishing tags
Tag verification
Signed commits
Merging signed tags (merge tags)
Summary
6. Advanced Branching Techniques
Types and purposes of branches
Long-running, perpetual branches
Integration, graduation, or progressive-stability branches
Per-release branches and per-release maintenance
Hotfix branches for security fixes
Per-customer or per-deployment branches
Automation branches
Mob branches for anonymous push access
The orphan branch trick
Short-lived branches
Topic or feature branches
Bugfix branches
Detached HEAD – the anonymous branch
Branching workflows and release engineering
The release and trunk branches workflow
The graduation, or progressive-stability branches workflow
The topic branches workflow
Graduation branches in a topic branch workflow
Branch management for a release in a topic branch workflow
Git-flow – a successful Git branching model
Fixing a security issue
Interacting with branches in remote repositories
Upstream and downstream
Remote-tracking branches and refspec
Remote-tracking branches
Refspec – remote to local branch mapping specification
Fetching and pulling versus pushing
Pull – fetch and update current branch
Pushing to the current branch in a nonbare remote repository
The default fetch refspec and push modes
Fetching and pushing branches and tags
Fetching branches
Fetching tags and automatic tag following
Pushing branches and tags
Push modes and t...

Table of contents