DEV Community

Cover image for Git & Github
Arshdeep Singh
Arshdeep Singh

Posted on

Git & Github



||||||||||||||||||||||||||||||||||||||||||||||||||

Installation

  • Install Git >## Verify Installation Don’t know if git installed successfully or not?
    • Verify if Git is installed, by using the following command in the Git Bash Terminal :
git --version

This Command will return the version of git in floating digits which verifies that Git has been installed successfully

Get started with Git

Don’t know where to start?, Check this easy **stepwise* guide below:*

1. Create a New Folder

mkdir Folder

This command will create a new folder named *Folder in your Current Directory(cd)*

2. Initialise Git

cd Folder/
git init

This command will create a new hidden folder inside your Folder

3. Create Readme.md file

cat > Readme.md

This command will create a new Markdown file namely Readme.md inside Folder

Hello World!```


*Type above text or any other Markdown Text inside `Readme.md` file*


press ctrl+c```

Press Ctrl+c to save & exit the Readme.md file

4. Staging



git add .

Use this command for staging all the files


Or

git add Readme.md

Use the following command for staging the Readme.md file

5. Committing




git commit -m "My First Commit"

Use this command to commit the Readme.md file with the message as *"My First Commit"*. Use relevant messages while committing

6. Remote Repository

Here we will be using GitHub for the remote repository

  • Go to Github
  • Create a new Repository by clicking on either of these 2 buttons shown below: image.png
  • After this it will redirect to a new Repository form, Fill the Name of the repository you want to give to your very first Repository (e.g. Understanding-git)
  • Once the Repository is created, you will be able to see a page somewhat similar to the following screenshot : image.png
  • In this Screenshot, the highlighted Green Line is the Repository URL
  • Copy the Repository URL and add in the below command to add the remote to origin




git remote add origin [Repository URL]

7. Git Push






git push -u origin master

This Command will push all the code from the local repository into the remote repository

Additional Commands:

Some more commands to help you manage with your version control journey:

Git Pull

git pull origin master

This command will pull the latest changes from the remote repository into the local repository. The remote repository code is updated continuously by various developers, hence git pull is necessary

Git Clone

git clone [repository url]

This command is used to clone an existing remote repository into your computer

Git Status

git status

This command find out information regarding what files are modified and what files are there in the staging area

Git Log

git log

This command will print out all the commits which have been done up until now

New Branch

git branch [Branch Name]

This command creates the Branch named as [Branch Name]

Git Checkout

git checkout [Branch Name]

This command will switch(checkout) current branch to [Branch Name]

||||||||||||||||||||||||||||||||||||||||||||||||||

image.png

CONGRATULATIONS 
¯\_(ツ)_/¯
Now you know the basics of how to use Git.

||||||||||||||||||||||||||||||||||||||||||||||||||

TAGS:

#git

#opensource

May The Source Be With You! Articles about Open Source and Free Software as a philosophy, and its application to software development and project management.


||||||||||||||||||||||||||||||||||||||||||||||||||

LINK TO MY PREVIOUS BLOG:



||||||||||||||||||||||||||||||||||||||||||||||||||

FOR MORE UPDATES, LET'S CONNECT:

GITHUB

                    trophy

Arshdeep Singh

Arshdeep Singh

          🏆 🅐🅦🅢 🄳🄰🅃🄰-🄴🅇🄲🄷🄰🄽🄶🄴-🄲🄷🄰🄻🄻🄴🄽🄶🄴 🅦🅘🅝🅝🅔🅡 🏆          

          🏆 🅡🅐🅛🅛🅨𝕋𝕠🆄🆂 🅦🅘🅝🅝🅔🅡 🏆          

arshdeepsahni    arshdeepsahni    arshdeepsahni

🏆 Winner : • AWS DATA-EXCHANGE Hackathon, USA
RALLYtoUS + VetsinTech Online Hackathon
🔭 Recent Project : A Crowdsourcing Application.
🌱 Currently Learning : Python and its implementations.
👯 Collaboration : Flutter Web Apps Projects & Any Innovative Startup Ideas!
🤝 Get Me : Referrals and Opportunities to intern and work with Product Based MNCs.
📝 Blog : dev.to & CodeWithArsh - Hashnode
📫 Contact : ✉️ Mail    📞 Whatsapp    ℹ️ LinkedIn

Skills


𝓢

𝒌

𝓲

𝓵

𝓵

𝓢

🄷🅃🄼🄻

🅒🅢🅢

🅱ootstrap

🅹ava🆂cript

🅒✚✚

🐍𝒫ython

🧿ⅅart

📱𝓕lutter

⚛︎ℝeact

🅹🆂🅧

⚡️𝙁astAPI

🐘PostgreSQL

anything related to Tech...


bashbootstrap c cplusplus css3 dart fastAPI figma flutter framer git html5 hugo ionic java javascript linux
objectivec PostgreSQL python react

STATISTICS

Streak

arshdeepsahni arshdeepsahni

Project Gallery

TrackMyCovid: Covid Tracking, Statistics & Analysis App

SheHeroes: Women Safety App

arshdeepsahni arshdeep-singh-418a9b194 arshdeep-singh-418a9b194








DEV.TO
arshdeepsahni image

Top comments (0)