DevOps Classroom Series – 19/Nov/2021

Solution to Exercise

  • Git by default will accept changes in files (new, modified, deleted) as a change but not empty directories
  • Empty directory cannot be added to git version by default.

Git Contd

  • Staging area can be considered as a draft area where you can add your changes, once you are ok with changes you can commit them or if you are not ok modify further or remove them staging area
  • In Git the files that are part of version control i.e. local repo are considered as tracked files.
  • We have done two changes
    • modify the existing file
      • Status: modified
    • create the new file
      • Status: UnTracked
  • To add the files to the staging area
    • specific path => git add <path to file>
    • modified files => git add -u
    • All the changes => git add -A
    • All the changes w.r.t to current directory git add .
  • Lets add all the changes
  • Lets make some more changes and add to the staging area
  • Lets make some more changes in the working tree
    • Status:
    • Difference:
  • Lets add all the changes and commit to the local repo
  • Lets look at the history
  • Lets create a fourth commit where we modify the existing content
  • Now lets understand more about diff
    • Scenario 1: Working Tree is clean
    • Scenario 2: Find difference in two commits
    • Scenario 3: Find difference in range of commits
    • Lets revisit diff after we understand git configurations
  • Overview of commands
  • Lets try to understand Removing the Changes from staging Area
    • Lets add some change to staging area
    • Now lets use reset as shown below to move the changes from staging area to workig tree
    • Now lets remove the changes from working tree as well
  • NOw lets create a change and add to the staging area with modified and untracked changes
    • Add changes to staging area
    • Move the changes back to Working tree
    • To remove the changes from modified file we can use git checkout
    • git clean will remove the untracked files from your working tree

Leave a ReplyCancel reply

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

Please turn AdBlock off
Customized Social Media Icons from Acurax Digital Marketing Agency

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Exit mobile version
%%footer%%