170 likes | 293 Vues
Learn how Git stores project data as snapshots over time. Follow steps to initialize a repository, set up identity, and efficiently add and commit files. Plus, recover files from local repository when needed.
E N D
Git stores data as snapshots of the project over time • When commit • Save all the files • If files have not changed, point to the previous identical file • To be more efficient • Create a ID to reference the commit • ID=SHA1
Other SCM systems Other systems tend to store data as changes to a base version of each file.
Initializing a Repository in an Existing Directory • Create a folder • Inside the folder • $ gitinit
.git Folder • Init command creates .git folder • Local repository • Invisible folder • To display invisible folders $ ls -la
Inside .git folder $ ls–l .git
Your Identity • Keep tracking of who worked on the code • Name • Email • Example $ gitconfig --global user.name "John Doe" $ gitconfig --global user.emailjohndoe@example.com • Identify is save in .gitconfig • Under the home foler
Cat .gitconfig • Show the configuration information
Staging Area Before and after git add
Recover files from .git • You can recover them from .git (local repository) • After deleting files from working directory