๐Ÿš€ Mastering Git & GitHub: A Quick Guide for Beginners!

Sonica SonawaneSonica Sonawane
2 min read

If you are stepping into the world of development, Git and GitHub are essential skills you must master. Hereโ€™s a simple and complete guide to get you started! ๐ŸŒŸ


๐Ÿ›  Setting Up Git

  1. Install Git from git-scm.com

  2. Configure your identity:

     bashCopyEditgit config --global user.name "Your Name"
     git config --global user.email "your-email@example.com"
     git config --global color.ui auto
    

๐Ÿ“ Creating a GitHub Repository

  1. Sign in to GitHub.

  2. Click the โ€œ+โ€ icon โž” New repository.

  3. Name your project, add a description, and choose Public/Private.

  4. Initialize with a README (recommended).

  5. Start collaborating and showcasing your work!


๐Ÿ”ฅ Essential Git Commands

ActionCommand
Initialize a repositorygit init
Stage filesgit add <file> or git add .
Commit changesgit commit -m "your message"
Check statusgit status
View commit historygit log
Create a branchgit branch <branch-name>
Switch branchesgit checkout <branch-name>
Merge branchesgit merge <branch-name>
Push changesgit push origin <branch-name>
Pull updatesgit pull
Clone repositorygit clone <repo-url>

๐Ÿ”„ Forking and Updating Repositories

  • Fork a repository to create your own copy:

    Click Fork on GitHub.

  • Clone the fork:

      bashCopyEditgit clone https://github.com/your-username/forked-repo.git
    
  • Keep your fork updated:

      bashCopyEditgit remote add upstream https://github.com/original-owner/original-repo.git
      git fetch upstream
      git checkout main
      git merge upstream/main
      git push origin main
    

โœจ Bonus Tips

๐Ÿ”น Undo staged changes:

bashCopyEditgit reset <file>

๐Ÿ”น Temporary save with stash:

bashCopyEditgit stash

๐Ÿ”น Rebase to clean commit history:

bashCopyEditgit rebase main

๐Ÿ”น Ignore files:
Create a .gitignore file and list patterns to exclude.


๐Ÿ“š Final Note

๐Ÿ”ต Git is your local version control tool.
๐ŸŸฃ GitHub is your cloud collaboration platform.


๐Ÿš€ Conclusion

Git is the engine behind your projectโ€™s timeline.
GitHub is the showroom where you display your projects to the world.

Start small, practice daily, and soon youโ€™ll be collaborating like a pro! ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

0
Subscribe to my newsletter

Read articles from Sonica Sonawane directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sonica Sonawane
Sonica Sonawane

Hi, I'm Sonica! ๐Ÿ‘‹ Iโ€™m currently diving into the world of DevOps, focusing on AWS, Docker, Kubernetes, Linux, and GitHub. My passion lies in automating systems, building cloud infrastructure, and optimizing workflows. Iโ€™m committed to continuous learning, hands-on projects, and sharing my journey with others in the tech community. Before shifting to DevOps, I worked in IT Sales, where I gained valuable skills in client communication, requirement gathering, and problem-solving. This experience taught me how to connect technical solutions to business needs, which has been instrumental as I transition into DevOps, where technical expertise and problem-solving go hand in hand. Now, Iโ€™m eager to apply my sales experience alongside my growing technical skills in cloud engineering and DevOps. Join me as I explore the latest trends, challenges, and solutions in the world of cloud computing!