My First Experience with Git and GitHub.
Timothy Mwangi
Virtual Assistant | Customer Support Specialist | AI Enthusiast | Specializing in Efficient Administrative Solutions & Exceptional Client Support for Education and Service-Based Organizations
What was your first experience working with code? I struggled a lot with Git and GitHub.
Here are the key areas where I faced challenges:
This blog is for anyone who might face the same challenges, to make it easier for them to understand.
Understanding GitHub.
GitHub is like a social media platform for developers, similar to Facebook, WhatsApp, or Instagram. It’s a version control system where developers share their code and get feedback. You can make your code public or keep it private. Private codes are usually for important projects.
Creating a GitHub Account.
To create a GitHub account, follow these steps:
Resetting Your GitHub Password
If you forget your GitHub password, you can reset it by:
GitHub Terminologies.
Here are some common GitHub terms and their uses:
Collaboration.
Collaboration, GitHub allows multiple users or a team to work together on a single code repository
Examples of how to collaborate.
Git Clone.
Git Clone: Creates a local copy of a remote repository on your computer. This allows you to work on the project offline and make changes without affecting the original repository.
Forking:
What is a Fork?
A fork in Git is essentially a copy of an existing repository. It’s like creating a duplicate of a project, allowing you to make changes without affecting the original repository. This is particularly useful for:
How Does Forking Work?
Clone the Fork: Clone your forked repository to your local machine: Bash git clone https://github.com/your_username/forked_repository.git
Putting It all together.
Configure Git: Open your terminal or command prompt and run the following commands to set up your Git configuration:
领英推荐
Example .
git config — global user.name “Your Name”
git config — global user.email “[email protected]”
Creating a Repository
Initialize a Git Repository: In your terminal, navigate to the directory where you want to create the repository and run the following command:
git init
Use code with caution.
Add Files: Add your code files to the repository using the git add command. For example: Bash git add .
Commit Changes:
Commit your changes with a descriptive message: Bash git commit -m “Initial commit”
Use code with caution.
Working with Branches
Create a New Branch: Create a new branch for a specific feature or bug fix: Bash git branch new-feature.
Switch to the New Branch:
git checkout new-feature
Merge the Branch:
Once you’re done with the feature, merge the branch into the main branch: Bash git checkout main
git merge new-feature
Pull vs. Merge:
- Pull: Download changes from a remote repo.
- Merge: Combine changes from two branches.
Add a Remote: Connect your local repository to the remote GitHub repository: Bash git remote add origin https://github.com/your_username/your_repository.git
Push Changes: Push your commits to the remote repository:
git push origin main
The End ??????
Follow Timothy Mwangi
Full Stack Developer|Virtual Assistant|Crypto Enthusiast
1 个月Very informative