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

Finding lost changes with git fsck


Another tool exists in Git that can help you find and recover lost commits and even blobs (files), which is git fsck. The fsck command tests the object database and verifies the SHA-1 ID of the objects and the connections they make. This command can also be used to find objects that are not reachable from any named reference, as it tests all the objects found in the database, which are in the .git/objects folder.

Getting ready

Again, we'll use the hello world repository. If you make a fresh clone, make sure to run the scripts for this chapter (04_undo_dirty.sh), so there will be some objects for git fsck to consider. The scripts can be found on the book's home page. If you just reset the master branch after performing the other recipes in the chapter, everything will be ready.

We can create the fresh clone as follows:

$ git clone https://github.com/PacktPublishing/Git-Version-Control-Cookbook-Second-Edition_hello_world_cookbook.git$ cd Git-Version-Control-Cookbook...
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