Github Basic Commands 1707840360
Github Basic Commands 1707840360
Commands
This section will provide an overview of some popular Github commands
for efficient version control and collaboration.
S by Santosh H
Cloning a Repository
Steps to Clone a Repository Key Points
1. Navigate to the repository on Github. Cloning allows you to create a local copy of the
repository to work on.
2. Click on the "Code" button and copy the URL.
It's the first step in making contributions to
3. Open your terminal and use the command "git
open-source projects or collaborating with team
clone [URL]" to clone the repository to your local
members.
machine.
Creating a New Branch
1 Reasons to Create a New Branch 2 Steps to Create a New Branch
To work on a new feature without affecting 1. Use the command "git checkout -b
the main project code. [branchname]" to create and switch to a
new branch simultaneously.
Adding and Committing Changes
1 Add Changes
Use "git add ." to stage all changes for the next commit.
2 Commit Changes
Execute "git commit -m 'commit message'" to save staged changes to the
local repository.
1. Use "git pull origin [branchname]" to fetch and Pulling ensures that your local repository is up to
merge changes from the remote repository to date with the latest changes made by other
the local repository. collaborators.
100 3K 4
Total Commits Active Contributors Branches Merged
View the total number of Identify the number of unique Determine the count of merged
commits made to the contributors who have made branches by running "git branch
repository using "git log -- commits to the repository with --merged | wc -l".
oneline | wc -l". the command "git shortlog -s |
wc -l".