Skip to content

Kumar-Aryan-NIET/Git-and-GitHub-Reference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Git-and-GitHub-Reference

1.    What is Version Control System and its Types
2.    What is Git?
3.    What is GitHub?
4.    And the difference between the two.

What is Version Control System?

download

  • VCS or version control

    • is a management system
    • that tracks changes in a computer file.
  • It is a software tool that records and manages changes

    • to the source code over a period of time.
Q. imagine that you are working with your friend on a shared document and two of you are making changes in the file at the same time, what will happen? How will you track the change and mark the owner of the same? Or maybe you are working in a large team, how will you manage then?
  • It helps developers to work efficiently.

A version control system can do these for you

- rollback and revert files back to a previous state or 
- revert the entire project back to a previous state, 
- compare changes over time, 
- see who last modified something that might be causing a problem, 
- who introduced an issue and when, and more, .

Types of Version control

Basically there are three major types of VCS.

  1. Local Version Control Systems
  2. Centralized Version Control Systems
  3. Distributed Version Control Systems

What is Git?

download

official Link to Dowload

  • https://git-scm.com/download/win

  • Git is one of the most popular Version Control System.

  • Git was originally developed in 2005 by the creator of Linux.

  • Git is free and open-source software so, anyone can use it.

What is GitHub?

download

GitHub

  • is one of the most advanced and developed hosting platforms
    • for version control and collaboration.
  • It is a web-based service for version control using Git
    • has all the benefits of git and even more.

download download

Set user name and email – Git

  • git config --global user.name "Your Name"
  • git config --global user.email [email protected]

To confirm it

download download

  • change like adding / deleting etc.

    • it's history will save in "git repository" named ".git"
  • how do we get this folder ?

    • git init - initialize an empty git repository (means folder)

download

cd "FolderLocation" ~ Change Directory

ls                  ~ Show all file in directory (Not the hidden once)

ls -a               ~ Show all hidden file (files start with ".")

ls ".FolderName "   ~ Show what folder contians.
touch "FileName.Extension"   ~ create file

git status                   ~ what are the changes made in the project which is not currently saved in terms of record
                             ~ tells about the changes which are not in the history of your project
                             ~ show untracked file

download

  • Untracked File (Red File) ~ like "Main.java" above means they are in "Staging Area"
git add "."(all untracked file) or "FileName"(particular file) ~ Save untracked file history in git repositry

download

green file like "main.java" above means they are at stage Area and now we can commit.
git commit -m "message"  ~ allow to write description about last last tracked files. 
                         ~ and show which type of change occur

download

############################################################################

download

  • above status means there is no untracked file and all you changes are recorded
vi "FileName.Ex.."  ~ view, write and modify the file content

download

download

press "esc" and then press ":x" to exit
cat "FileName.Ex.." ~ only show the file content in terminalgit 

download

#############################################################################

download

  • above status shows modification in file

by using git add .

download

git restore --staged ~ used to unstage

download

git restore  ~ to discard changes in working directory
git log      ~ used to view the history

download

rm -rf <FileName>    ~ used to remove file

download

- you can not directly remove a commit from anywhere
- for remove it, unstage them upto that commit you want to remove 
  - from top to bottom

- copy the commit id just below it
- use "git reset <commit id>" to unstaged changes after reset those commit

download

now the other are go to unstaged area

FIRST satage the changes

download

Git stashing

  • Don't want to commit and don't want to lose these changes
  • use "git stash"
    • basically want you to go back stage and
    • when ever I want you I bring you back

download

how to bring back to staging area

  • use "git stash pop"

download

  • not committed and in the saperate structure ( at back stage)
  • To remove them
    • Use "git stash clear"

download download

git    - means git
remote - means you are working with url
add    - add a new url
origin - name of the url

download

git remote -v ~ show you all url attached to that folder

download

  • To share the changes at that url
    • Use "git push origin master"

Where,

  • origin - url name
  • master - branch

download

download

Setup SSH Key to GitHub

download

"ssh-keygen -t ed25519 -C [email protected]"  ~ generate pulic and private key pair

download

"clip < ~/.shh/id_ed25519.pub" ~ Clip SSH Keys to clipboard (so you can paste SSH Keys anywhere after it directly)

download

download

Push The Repository

download

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published