OpenSource For You

The working directory and staging area

-

The woUNLng GLUeFWoUy LV Whe UeSoVLWoUy GLUeFWoUy wheUe fiOeV are checked out. Whenever you want to do a commit after mDNLng Vome moGLfiFDWL­onV, XnOLNe oWheU YeUVLon FonWUoO VyVWemV, *LW wLOO noW WUDFN Whe moGLfiFDWL­onV mDGe Wo DOO Whe fiOeV Ln Whe woUNLng GLUeFWoUy. :hen yoX Go D Git commit, it wLOO OooN DW Whe fiOeV DGGeG Wo Whe VWDgLng DUeD. 2nOy fiOeV Ln the staging area are considered for a commit. Basically, the staging area is a method by which you can selectivel­y add fiOeV Ln Whe FXUUenW woUNLng GLUeFWoUy IoU D VSeFLfiF FommLW. /eW’V VXSSoVe WheUe DUe 10 fiOeV Ln Whe GLUeFWoUy. <oX mDGe moGLfiFDWL­onV Wo IoXU fiOeV, EXW FhDngeV Wo Wwo fiOeV EeOong Wo D SDUWLFXODU IeDWXUe DGGLWLon, DnG oWheU moGLfiFDWL­onV EeOong Wo some other feature. vou don't want to commit changes related to two features in a single commit, but changes related to one feature in one commit, and other changes in another commit. The staging area helps you to do that, as follows:

git add file1 file2 file3

…FDn Ee XVeG Wo DGG fiOeV Wo Whe VWDgLng DUeD, DnG When run git commit to add those changes in the staging area to a new FommLW. AIWeU Whe fiUVW FommLW, DGG Whe oWheU fiOeV, DnG Go the next commit. The git add command basically moves the DGGeG fiOeV Wo Whe VWDgLng DUeD; onOy DGGeG fiOeV DUe FonVLGeUeG for a commit.

(YeUy oEMeFW Ln *LW FDn Ee UeIeUenFeG Ey Whe SHA1 hDVh (41 FhDUDFWeUV). UVXDOOy, yoX Go noW neeG Wo WySe 41 FhDUDFWeUV—IoU Dny UeIeUenFe, onOy Whe fiUVW fiYe FhDUDFWeUV oI the hash are required.

HeUe, A LV Whe fiUVW FommLW DnG B, C DnG ' DUe nexW FommLWV. ' LV Whe H(A' FommLW (Whe ODWeVW). 2ne oI Whe GeYeOoSeUV ('eY1) FOoneV Whe UeSo Wo hLV OoFDO mDFhLne, DnG DGGV D Iew moUe commits. Let us represent his local repo as follows:

Newspapers in English

Newspapers from India