- First, create a
GitHub account
bySign in
via your email at this Link. If you already had an account then start with thesetup step👇
While creating your account remember that you have to use your own name as the
username
. - Download Git in your system : 👉Download from here👈.
-
For Git to work properly, we need to let it know who we are so that it can link a local Git user (you) to GitHub. When working on a team, this allows people to see what you have committed and who committed each line of code.
-
Open any terminal or command prompt and enter the below commands. The commands below will configure Git. Be sure to enter your own information inside the quotes.
git config --global user.name usernamehere
git config --global user.email [email protected]
- To verify that things are working properly, enter these commands and verify whether the output matches your name and email address.
git config --get user.name
git config --get user.email
Important
✅ Must watch Learn Everything about Git & Github here
-
git init
- Initializes a Git repository in the current directory. This is the first command you run when starting a new Git project. -
git add filenamewithextension
- Adds a file to the staging area, tracking changes and preparing it for the next commit. You can also use git add . to add all files. -
git commit -m "commit message"
- Commits changes to the local Git repository, capturing a snapshot and associating a commit message. Commit messages should be clear and concise. -
git push
- Uploads local repository content to a remote repository, such as GitHub. -
git pull
- Downloads content from a remote repository and merges it into the local repository. This incorporates changes made by other contributors. -
git status
- Lists files that have changes not yet staged for the next commit and files in the staging area that will go into the next commit. -
git log
- Shows a list of all previous commits, their commit messages, and which authors made the commits. -
git branch
- Lists, creates, or deletes branches within a repository. -
git checkout <branch>
- Changes the working directory to the specified branch. This allows you to switch between branches. -
git merge <branch>
- Combines the specified branch into the current branch. This integrates changes from one branch into another. -
git diff
- Shows the differences between commits, the staging area, and your current working directory.