Skip to content

πŸ“˜ CHAPTER-2 πŸ“˜ Understanding and practicing git - Hands-on Training πŸš€

License

Notifications You must be signed in to change notification settings

CodeMacrocosm/Git-Training

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Git Training: "Unlock Git Mastery: Elevate Your Collaboration Game! πŸš€πŸ’»πŸŒ πŸ“˜πŸš€

🌟🌟🌟🌟

GitHub stars

GitHub forks

🌟🌟🌟🌟

Table of Contents

  1. Overview
  2. Introduction to Version Control Using Git
  3. Setting up Git
  4. Git Cheat Sheet
  5. Uploading Files to GitHub with Branching
  6. Why This Git Training?
  7. License
  8. Star This Repository
  9. Conclusion

Overview

Welcome to Git Training, a Hands-On Training repository led by Shreya Malogi! 🌟 comprehensive guide to getting started with Git. This training edition covers not only the basic GitHub workflow but also provides an introduction to version control using Git, essential command-line interface commands, and a Git cheat sheet. πŸ“˜πŸš€

Introduction to Version Control Using Git

What is Version Control?

Version control allows you to manage a πŸ”„ collection of files, such as πŸ’» source code for a project or πŸ“ files for a website, by πŸ•°οΈ keeping track of changes over time. It eliminates the ✨ need to archive entire directories to 🀝 maintain different versions manually. Git, a distributed version 🌐 control system, is widely used for efficient collaboration and code management.

Learning Objectives

  1. Learn basic command-line interface commands:
    • mkdir, cd, ls, rm, mv πŸ’»
  2. Installing Git
  3. Learn basic Git commands:
    • log, status, diff, stash, commit, add, rm, .gitignore, branch, checkout πŸš€
    • Cloning, pulling, push πŸ”„
  4. Learn basic GitHub actions:
    • Pull requests, forking 🌐

Setting up Git

Download & Install Git from git-scm.com. ⬇️

Configuring Git Settings (Initial Setup) πŸ€–

After installing Git, introduce yourself to Git with your name and public email address:

git config --global user.email "yourmail@example.com"
git config --global user.name "Your User Name Comes Here" 

Checking Configuration πŸ•΅οΈ

To check your credentials:

git config user.name 
git config user.email 

Make sure you run these commands in your working folder/project folder. πŸ“‚

Git Cheat Sheet

Command Description
git init Initialize a new Git repository πŸ”„
git clone <url> Clone a repository into a new directory πŸ“‚
git remote add origin <url> Add a remote repository 🌐
git remote -v Display remote repositories πŸ“Š
git status Show the working tree status 🌳
git add . Add changes to the index βž•
git commit -m "Commit Message" Commit changes with a message πŸ“
git commit -am "Commit Message" Add and commit changes in one command πŸ“¦
git push origin master Push commits to a remote repository πŸš€
git fetch Download objects and refs from a remote repository πŸ“₯
git pull Fetch from and integrate with another repository or a local branch πŸ”„
git branch List, create, or delete branches 🌿
git checkout <branch> Switch branches or restore working tree files πŸ”„
git merge <branch> Join two or more development histories together 🀝
git log Show the commit logs πŸ“œ
git diff Show changes between commits, commit and working tree, etc. ↔️
git stash Stash changes in a dirty working directory away πŸ“₯
git rm <file> Remove files from the working tree and from the index ❌

Uploading Files to GitHub with Branching" πŸš€πŸ“‚

Here's the complete set of commands to upload files to GitHub using Git, including creating a new branch:

  1. Initialize a Git Repository:

    git init
  2. Add Files to the Staging Area:

    git add .   # Add all files

    or

    git add <file1> <file2>   # Add specific files
  3. Commit Changes:

    git commit -m "Your commit message here"
  4. Create a New Branch:

    git branch <branch-name>

    This command creates a new branch but doesn't switch to it.

  5. Switch to the New Branch:

    git checkout <branch-name>

    or, using the more recent git switch command:

    git switch <branch-name>

    Alternatively, you can combine branch creation and switching in one command:

    git checkout -b <branch-name>
  6. Make Changes, Add, and Commit in the New Branch:

    git add .
    git commit -m "Your commit message here"
  7. Add a Remote Repository (GitHub):

    git remote add origin https://github.com/your-username/your-repository.git
  8. Push the Changes to GitHub:

    git push -u origin <branch-name>

    The -u option sets the upstream branch for the new branch.

Now, you've initialized a Git repository, added files, committed changes, created a new branch, made changes in the new branch, and pushed the changes to GitHub. Remember to replace your-username, your-repository, and <branch-name> with your actual GitHub username, repository name, and the desired branch name.

Happy coding and branching! πŸš€πŸŒΏ

🎯 Why This Git Training?

Whether you're a Git novice or eager to enhance your skills, this hands-on experience, ensures effective learning.

πŸ“œ License

Open-source under the MIT License.

MIT License

Copyright (c) 2020 CodeMacrocosm

🌟 Star This Repository

Show support if you find it helpful!

Conclusion

Congratulations! You've completed this extended tutorial and have a solid foundation in using Git for version control. Use the provided Git cheat sheet as a quick reference, and explore more about the power of pull requests in the GitHub Flow Guide. 🌟

Happy coding! πŸš€πŸŽ‰βœ¨πŸ‘©β€πŸ’»πŸŒŸπŸ

πŸš€ Let's Get Started!

Begin your Git journey today. Happy Learning! 🌟"

About

πŸ“˜ CHAPTER-2 πŸ“˜ Understanding and practicing git - Hands-on Training πŸš€

Topics

Resources

License

Stars

Watchers

Forks