Time for action – checking out using CLI mode

  1. Let's learn two more commands to add to your Git lingo.
    Git log
    Git checkout ___commit_id___
    

    Git log is for showing the history of a repository; it gives us information such as commit ID, author, date, and the commit comment given by us.

    We need the commit ID for use later.

    Time for action – checking out using CLI mode

    Don't worry about memorizing a sequence of 40 characters. Our magic wand, Git, does the hard work of filling in the remaining characters for you to identify a commit if you supply it with the first five characters.

  2. Let's see it in action.
    Time for action – checking out using CLI mode

    Now you have travelled back to a previous commit, and your files will contain the contents of the previous commit. You can view the contents of the file now.

    Note

    When you have checked back to a previous commit you are hanging in the air; any changes to your files now will be lost once you go back to the master. We'll see how to handle this in later chapters with a concept called branching.

  3. To return to the latest changes run git checkout master; this will bring you to the latest changes.
    Time for action – checking out using CLI mode

    If you see a message similar to the one in the previous screenshot, you have returned to your latest changes. Again, you can view the contents of the file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.54.63