DevOps Classroom Series – 20/Nov/2021

Git Contd

  • Lets create a change and add it to staging area (index) Preview
  • We can use restore command to move the changes from staging area to working tree Preview Preview Preview
  • Restore command can revert the changes from staging area and also working tree for any tracked files
  • Lets try to delete one file which is tracked Preview
  • Lets try to delete one more file which is tracked Preview Preview
  • Inspect your current commit id and make changes and add them to staging area, create untracked files
    • Changes done Preview
    • Now i want to clean/remove all the changes done in working tree as well as staging area. I want my working tree to be as it was i.e. as the changes were in sixth commit Preview
  • Current State: We are at sixth commit.
    • Overview Preview
    • We want our working tree to be as it was in commit (4) Preview Preview Preview
    • Note: Never use git reset –hard to go back to previous version if you dont have a remote repository, as you might not be able to undo changes
    • In our system since we are executing the commands immedietly so there is less chance that garbage collection might have happened. Git maintains a log on its own for all the changes you make in your local repo which is called as reflog. we can seek the help from reflog to recover the lost commits (5 & 6) Preview
    • Exercise: In git there is also reset –soft option. Findout what soft does.
  • Generally when working on any application we might have to make parallel releases, such as v1.8, v2.0
    • We need to use the concept of branching
    • In Git when we initalize a repository a default branch called as master gets created.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube