GIT Hands-on : 1
Install GIT in your local machine, Clone GitHub Repository to Local, Make Changes and Push to Remote Repository
How to Install Git :
Visit the official Git website for Windows: git-scm.com/download/win
Click on the
64-bit
or32-bit
version (depending on your computer's architecture) to download the installer.Once the download is complete, run the installer.
You'll be presented with various installation options. Keep the default settings unless you have a specific reason to change them.
During the installation, you'll encounter an option to adjust your system's PATH environment. Choose the option
Use Git from the Windows Command Prompt
. This allows you to access Git from the Command Prompt or PowerShell.
Complete the installation process by clicking Next
and Finish
.
To verify that Git is installed, open the Command Prompt or PowerShell and type the following command :
#From your shell, install Git using apt-get:
sudo apt-get update
sudo apt-get install git
git --version
git config --global user.name "your name goes here" #john
git config --global user.email "emailid.gmail.com" #john@gmail.com
If Git is installed correctly, it will display the installed version.
Using Git Clone to Local
Copy your remote GitHub Repository to your local machine using the below command.
git clone https://github.com/kshitijabartakke/git.git
cd git/ #Go to the repo
Create a file and commit
touch file1 #Add a specific file to the staging area
git add file1 #Add all changed files to the staging area
git commit -m "Your message here" #Commit changes with a descriptive messageAfter making changes to your files, use the following commands to add the changes to the staging area and commit them to the repository
git log --oneline #It will show what have you commited so far
Push to Remote Repository
git pull #Always pull before adding anything to remote repo
git push -u origin master #Mater or main as per root branch name
Now, You will get pop-up here to login to remote repo for sync.], after login it will perform push action by itself.
Conclusion:
In a nutshell, Git and GitHub make life easier for developers by keeping track of changes, allowing collaboration, and helping manage project versions effectively. Version control, especially with Git, is like a superpower that empowers developers to experiment fearlessly and work together effortlessly. Whether it's a small team or a global community, Git and GitHub foster creativity and innovation in the world of software development. So, let the coding adventures begin!