SAGARFIVE

1. Introduction

2. Git Basics

3.  Git Terminology

4.  Git Branching

5.  Git - Github

6.  Git Add (Git staging)

7.  Git Commit

8.  Github Advanced

9.  Git Remote

2.3 Git Work Flow

Project workflow of code changes :

Working Directory :

1. Create your project and open that directory , right click and select git bash here

2. Initializing the git

git init

3. Check your git project status

git status

Files status :


(i). Untracked Files (??)

(ii). Tracked Files → Modified(M)

                          → Staged(A)

                  → Un Modified (we can’t see)

Staging Area :

4. Add files to git project(add untracked files to project)

git add .

Let’s check once again git project status

git status

Here you can see files are in green color , and files now

Files Tracked → Moved to staging area → now files are staged

git add . → add all files in the directory to the git project. If you want to remove some files then you can use below (means you have to unstage means untracked).

5. If you again you added some files in that directory , and to add that files to git project

git status

Here you can see the newly added file is showing as untracked files that means it is not added to the git project.

4. Once after your changes done to project add that files to git project

git add <filename>

That new file was added to the staging area.(tracked → staged)

5. Again you want to modify the content of test.html.txt(one of your project file)

You can modify the content in the file and save it , now check git project status

Then we know that, if you modify that file shows as modified(tracked file)

Add that file to git project by using this command

git add <filename>

Then the file moves to staged area

6. For some reasons you want to remove a files that’s added but you don’t need that , then you can removed from git project

git rm – -cached <file>

Here you can see that file removed and marked as an untracked file, that means it won’t add that file to the git project.

Local Repository :

Finalizing the project committing : means moving to git local repository

git commit -m “test-version v 1.0”

Above commit is inline commit ,you can add a comment to identify release

We can take this as release versions or comment names on code updation.

Remote Repository :

Above commit is inline commit ,you can add a comment to identify release

We can take this as release versions or comment names on code updation.

Uploading local file to remote repository

For this you need to go to github.com and create account and add repository

And copy the repository url : https://github.com/sagar-gith/bootstrap-cards.git

Add local repository to github remote repository

→ changing the default branch to main (default branch in git is master, but in gitlab is main), so you need to rename branch before uploading to remote repository in github

git branch -M main

→ adding remote repository

git remote add origin https://github.com/sagar-gith/bootstrap-cards.git

→ pushing the project from your local repository to github remote repository

git push -u origin main

When you’re doing it for the first time it asks for you to authenticate git bash with github, you redirect to github , sign in in the browser and it’s done !

Your project is added to remote github repository , let’s check by refreshing the repository at github