Python Django – 11/08/2021

Five Areas of Git

  • As a Developer I Can think of Git is divided into 5 places/areas
    • Work Area
    • Index (Staging)
    • Local Repository
    • Remote Repository
    • Stash
  • Work Area: This where our current files are and where we make changes to the code
  • Index/Staging Area: If we want to create a change in code (i.e. new feature), we would need to commit the code. To commit the code, first we need to add the changes to the staging area
    • Lets create a file called as main.py Preview
    • Main.py is a file newly added and has no previous history, These kind of new files are shown as untracked in the status Preview
    • Now lets make some changes in README.md and execute the git status Preview Preview
  • Local Repository: This is repository maintained locally in .git folder & has history of commits
  • Remote Repository: This repository is present on remote server and generally represents the code which all the team members are using/sharing. Preview Preview
  • Lets look at history Preview
  • Now if we represent this history Preview
  • Using checkout command and commit id we can move the HEAD to previous commits i.e. when HEAD moves to previous commits , the Work Area will show the code w.r.t commit which we are present Preview
  • Lets try to add some changes to main.py and add to the staging area Preview
  • Now if you want to move the changes back from staging area to work area. We can use reset Preview
  • Add the changes back to staging area.
  • Now if you want to remove the changes from staging area and working tree we can use the command git reset --hard Preview
  • Now lets assume that you have added some files to the working tree (Not added to staging area yet) so they are untracked
  • If you want to remove all the untracked files git clean -fd . Preview Preview

Exercise

  • Write code to connect to SQLite Database (Django)
  • Writing a code to print the following
Welcome to Inventory

Enter 1 to Add Products
Enter 2 to Delte Products
Enter 3 to update Products

Leave a Comment

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

About continuous learner

devops & cloud enthusiastic learner