How To Used Git and GitHub
How To Used Git and GitHub
Configuring Git:
After installation, open a terminal or command prompt and set your name and email address:
To start using Git, you'll need to initialize a repository. Navigate to the directory where you want to
create your project and run:
git init
Adding Files:
Use git add to stage files for the next commit. For example:
Committing Changes:
Checking Status:
git status
git log
GitHub Basics:
Creating a New Repository on GitHub:
Click on the '+' sign in the top right corner and select "New repository". Follow the instructions to
create a new repository.
Pushing to GitHub:
To push your local repository to GitHub, you'll need to add a remote. Replace username and
reponame with your GitHub username and repository name:
Pulling Changes:
Branching:
Merging Branches:
After making changes in a branch, you can merge it back into the main branch (usually master):
Pull Requests:
When working with others, it's common to make changes on a separate branch and then create a
pull request on GitHub. This allows others to review your changes before merging them into the
main branch.