Changes between Version 40 and Version 41 of WorkingConventions/Git


Ignore:
Timestamp:
Sep 13, 2013 7:54:11 AM (10 months ago)
Author:
thoughtpolice
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WorkingConventions/Git

    v40 v41  
    131131 
    132132While you may think all hope is lost, '''the reflog can save you from all of these, and more'''. In short, the reflog ''is a log that records every modification which Git tracks''. To understand that, first understand this: despite its appearance, the Git data model has a core tenant: ''it is immutable - data is never deleted, only new copies can be made'' (the only exception is when garbage collection deletes nodes which have no outstanding references - much like our own GC!) Not even a rebase - which can rewrite the history - can actually delete old data. 
    133   
     133 
    134134Second, we need to understand an '''important part of `git checkout`''': the purpose of `checkout` is ''not'' to switch branches. Checkout, roughly speaking, '''allows you to check out your tree to any state, revision, or copy in the history'''. You don't have to checkout to a branch: you can checkout to a commit from 3 weeks ago, a commit that ''does not exist on a branch'', or a completely empty branch with nothing in common. You can checkout the entire tree, or you could checkout an individual file, or a single directory. The point being: '''checkout takes you to a state in the history.''' 
    135   
     135 
    136136So with that in mind, think of `reflog` like the audit log you can use to see what operations were performed on the immutable git history. ''Every'' operation is tracked. Let's look at an example, from Austin's ''validation tree'' he uses to push commits: 
     137 
    137138{{{ 
    138139$ git reflog --date=relative # this will open an interactive pager