DevOPs Classroom Series – 05/Feb/2021

Git contd..

Adding multiple changes to index area

  • In Git we can deal with multiple changes at one time and add all of those changes to the staging/index area.
  • Lets create two new files in folders and make changes to existing file and execute status command Preview
  • For git
    • untracked file => This was not present in the local repo and you have created a new file
    • modified => Made changes to existing files
    • If the new files are part of some folder, then git will show folder in the status but actually will track files.
  • Now lets add the changes Preview
  • Now lets commit the changes to the local repository Preview
  • Now lets create two more files in src and requirements.txt Preview
  • Now make changes in existing file ( and execute git status Preview
  • Now if we want to add only modified files not untracked files to index/staging area Preview
  • Now lets make some more changes in of src Preview
  • Now lets navigate to test folder
    • here git add . will not workout as changes are not in test folder, lets add all the files to the staging area using git add -A Preview Preview
  • Lets do a change by deleting a file src/ Preview
  • Now lets add these changes to repo via staging area Preview
  • Now execute git log Preview
  • Now lets make changes in 3 files and add that to staging area Preview Preview
  • Now lets try to reset the change in test/ and src/ Preview
  • Now if we want to remove the changes in test/ and src/ in the working tree as well Preview
  • If you want to remove all the changes in index area and working tree with one command Preview
  • Now lets create a new set of changes with untracked files, modified files Preview
  • Now to remove the untracked files Preview
  • Exercise: Findout the difference b/w git reset –hard and git reset –soft
  • Git Log Variants
    • Display All commits Preview
    • View n most recent commits git log -n Preview
    • Filter commits by author Preview
    • Filter commits by date
    git log --before <date>
    git log --after <date>
    Preview Preview
    • Viewing all the changes done in each commit git log -p Preview
    • To view summary of each commit git log --stat Preview

Leave a Reply

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

About learningthoughtsadmin