Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Git Version Control Cookbook

You're reading from   Git Version Control Cookbook Leverage version control to transform your development workflow and boost productivity

Arrow left icon
Product type Paperback
Published in Jul 2018
Publisher
ISBN-13 9781789137545
Length 354 pages
Edition 2nd Edition
Tools
Arrow right icon
Authors (4):
Arrow left icon
Kenneth Geisshirt Kenneth Geisshirt
Author Profile Icon Kenneth Geisshirt
Kenneth Geisshirt
 Zattin(EUR) Zattin(EUR)
Author Profile Icon Zattin(EUR)
Zattin(EUR)
 Olsson Olsson
Author Profile Icon Olsson
Olsson
 Voss Voss
Author Profile Icon Voss
Voss
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
1. Navigating Git FREE CHAPTER 2. Configuration 3. Branching, Merging, and Options 4. Rebasing Regularly and Interactively, and Other Use Cases 5. Storing Additional Information in Your Repository 6. Extracting Data from the Repository 7. Enhancing Your Daily Work with Git Hooks, Aliases, and Scripts 8. Recovering from Mistakes 9. Repository Maintenance 10. Patching and Offline Sharing 11. Tips and Tricks 12. Git Providers, Integrations, and Clients 1. Other Books You May Enjoy Index

Autosquashing commits


When I work with Git, I often create a lot of commits for a single bug fix, but when making the delivery to the remote repository, I prefer—and recommend—delivering the bug fix as one commit. This can be achieved with an interactive rebase, but since this should be a common workflow, Git has a built-in feature called autosquash, which will help you squash the commits together.

Getting ready

Before we begin with this exercise, we will create a branch from origin/master so we are ready to add commits to our fix.

Let's start with something like this:

$ git checkout -b readme_update_developer --track origin/masterBranch readme_update_developer set up to track remote branch master from origin.Switched to a new branch 'readme_update_developer'

How to do it...

After checking the branch, we will create the first commit that we want to squash other commits to. We need to use the abbreviated commit hash from this commit to automatically create other commits that will squash to this...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images