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
  • 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
  • Now lets commit the changes to the local repository
  • Now lets create two more files in src app.py and requirements.txt
  • Now make changes in existing file (Readme.md) and execute git status
  • Now if we want to add only modified files not untracked files to index/staging area
  • Now lets make some more changes in main.py of src
  • 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
  • Lets do a change by deleting a file src/app.py
  • Now lets add these changes to repo via staging area
  • Now execute git log
  • Now lets make changes in 3 files and add that to staging area
  • Now lets try to reset the change in test/main.py and src/main.py
  • Now if we want to remove the changes in test/main.py and src/main.py in the working tree as well
  • If you want to remove all the changes in index area and working tree with one command
  • Now lets create a new set of changes with untracked files, modified files
  • Now to remove the untracked files
  • Exercise: Findout the difference b/w git reset –hard and git reset –soft
  • Git Log Variants
    • Display All commits
    • View n most recent commits git log -n
    • Filter commits by author
    • Filter commits by date
    git log --before <date>
    git log --after <date>
    
    • Viewing all the changes done in each commit git log -p
    • To view summary of each commit git log --stat

Leave a ReplyCancel reply

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

Please turn AdBlock off
Social Network Integration by Acurax Social Media Branding Company

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%%