Quick High-Level

Conceptual Overview

Repository

A Git "Repo" is a workspace which tracks and manages file within a folder

Anytime we want to use Git with a project , app, etc we need to create a new git repositoy. We can have as many repos on our machine as needed . all with separate history and contents

Committing Git

Committing making a commit is similar to making a save in a video game . We're talking a snapshot a git repository in time

When saving a file , we are saving the state cuar a single file . With Git , we can save state of mutiple files and folders together

The basic git workflow

Work on stuff ( make new files , edit files , delete file , ect ) =>

Add Changes (Group specific changes together , in preparation of committing )

Commit(Commit everthing that was previously added)

Git first command

git status

git status gives information on then current status of a git repository and its contents

It is very useful , but at the moment we don't actually have any repos to check

if your try it . We will receivce message

Our Actual first fit Commands

Use git init to create a new git repository . Befor we can do anything git-related , we must initalize a repo first ! This is something you do one per project , initialize the repo in the top level folder containing your project

after use git init git tracks a directory and all nested subdrectiories

From now on git will manages it

after create foler .git with command-line git init . Try marking a new file in reposiory ,and then run git status,You'll see that git noticed the file , but it is untracked

what is untracked ?

I have three status : "working directory - Staging Area - Repository "

Untracked : message as git will listen all file changes and it inside status working directory . if you create a new file or edit file , git will listen , notice a change , git will add files in stauts 'Working directory'

Adding

use this command-line if you want to add some file

We use the git add command to stage changes to be commited .

It's away of telling git , "please include this change in our next commit "

after your add , git will give all files in status Staging Area with message tracked

Git commit

With command-line git commit . Git give add commit in status Repository Area . It look like snapshot or endpoints . endpoints will helps us back if we want

Case 1 : Sometime your add missing files after your commit . How to add file when you commited ?

Step 1 : Add files forgot . git add filename_forgot

Step 2 : use command-line git commit --amend

after use git commit --amend . git group all file in status Staging Area give for commit nearest

Case 2 : change commit nearest

if your want modify commit nearest .Your can use command line

Git ignored

Sometime we don't want push any file to git repository , example as key , password , etc...

we can do it with ignore file

Step 1 : create file .gitignore

step 2 : list add patch files inside file .gitignore

some syntax

Last updated