Skip to content

Soumik116/Onboarding-document

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 

Repository files navigation

Welcome to Git and GitHub at ChaiCode Cohort!

Learning by reading documentation is very important and even essential as a developer. As a developer, you will have to read a lot of documentation to learn about new technologies coming to the market every day. So it’s good to build a habit of reading documentation. We will learn Git and GitHub by reading documentation.

Getting Started with Git and GitHub

If you're new to Git and GitHub, don't worry! We'll start from the basics and guide you through. By the end of this onboarding guide, you'll have a solid understanding of how to use Git, GitHub, and their essential features for collaborating on projects.


What Are Git and GitHub?

  • Git: A Version Control System (VCS) that helps you track changes in your code. Think of it as a checkpoint system for your code—every time you make a commit, Git saves your code's history, allowing you to access it later.
  • GitHub: An online platform that provides a beautiful user interface for Git. It makes collaboration easy by enabling teams to work on projects from anywhere in the world. It is an essential tool for team collaboration.

Step 1: Installing Git

  1. Open any browser and search for Git download.
  2. Download Git for your specific operating system (Windows, macOS, or Linux).

git download

  1. Install Git on your system.
  2. During installation, you'll also get Git Bash, a terminal ideal for learning Git commands.

Pro Tip: While you can use other terminals (like VS Code's terminal), some Git commands work best on Git Bash.

  1. Open github.com and create an account.

github signup github username


Step 2: Setting Up Git

After installation, follow these steps to configure Git:

  1. Open Git Bash.

  2. Run the following commands to set your username and email (used for commit tracking):

    git config --global user.name "Your Name"
    git config --global user.email "[email protected]"
  3. To verify the configuration, use:

    git config --list

Step 3: Cloning a Repository

  1. Open the GitHub repository you want to copy, click on the "Code" button, and copy the repository link.cloning

  2. Create a folder on your computer where you want to clone the repository.

  3. Open Git Bash and navigate to the folder you created using the command:

    cd <folder-directory>
  4. Clone the repository by running:

    git clone <repository-link>
  5. You have successfully cloned the repository!


Step 4: Basic Git Commands

There are two ways to open a specific folder or repository:

cd <folder_directory>

or right-click the folder on your computer, select "More options," and choose "Open Git Bash here" open git bash

Here are some essential Git commands you'll use frequently:

Command Description reference image
git init Initializes a new Git repository in the current directory. Screenshot 2025-01-11 133816
git status Shows the status of your repository (e.g., changes, untracked files). git status
git add <file> Adds specific files to the staging area. git add
git add . Adds all changes in the directory to the staging area. git add2
git commit -m "message" Saves changes to the repository with a descriptive message. git commit
git log Displays the commit history. git log
git push Pushes local changes to the remote repository. git push
git pull Fetches and merges changes from the remote repository. git pull

Step 5: Getting Started with GitHub

  1. Sign Up: Create an account at GitHub.
  2. Create a Repository:
    • Click on "New Repository" and give it a name.
    • Choose whether it will be public or private.
  3. Connect Git to GitHub:
    • Copy the repository's URL.

    • In your terminal, run:

      git remote add origin <repository-url>
      git push -u origin main

Branching Workflow

At ChaiCode, we use a structured branching strategy to manage our projects effectively:

  • main branch: The stable production branch.
  • development branch: The integration branch for ongoing development.
  • Feature branches: Separate branches for working on specific features or fixes. These branches are merged into development once complete.

Creating and Switching Branches

To create and switch to a new branch:

git branch feature/tea-menu
git checkout feature/tea-menu

Alternatively, use:

git checkout -b feature/tea-menu

Merging Branches

To merge a feature branch into development:

  1. Switch to the development branch:

    git checkout development
  2. Merge the feature branch:

    git merge feature/tea-menu

Resolving Conflicts

If there are merge conflicts:

  1. Open the conflicting files and make the necessary edits.

  2. Add the resolved files to the staging area:

    git add <file-name>
  3. Commit the merge:

    git commit

Creating a Pull Request (PR) on GitHub

A pull request (PR) is used to propose changes and collaborate on code reviews. Follow these steps to create a PR:

  1. Push your branch to GitHub:

    git push origin <branch-name>

creating new branch git pull request 2

  1. Go to the repository on GitHub and click on Pull Requests.
  2. Click New Pull Request.
  3. Select the base branch and compare branch.

Writing a PR Description

  • Provide a clear and concise description of the changes.
  • Include the purpose of the PR and any relevant context.
  • Mention related issues or tasks using keywords like Fixes #issue-number.

Requesting Code Reviews

  • Add reviewers who are familiar with the codebase or the changes.
  • Highlight specific areas in the code that require attention.

pull request 4155-49e1-b941-094987b5ce73)


Best Practices for Using Git and GitHub

  • Write Clear Commit Messages: Use descriptive messages that explain what your changes do. Example:

    Added user authentication feature
    
  • Commit Frequently: Commit small, logical changes often to keep your project’s history clean.

  • Use Branches: Create branches for new features or bug fixes. Example:

    git checkout -b feature/new-feature
  • Collaborate Effectively: Use pull requests to review and discuss code changes with your team.

  • Resolve Conflicts: When working with a team, learn how to resolve merge conflicts effectively.


Creative Tip: Naming Your Branches

Use meaningful and consistent branch naming conventions:

  • feature/<feature-name>: For new features.
  • bugfix/<issue-name>: For fixing bugs.
  • hotfix/<critical-issue>: For urgent fixes.

Resources to Learn More

Welcome aboard, and happy coding! 🚀

About

An onboarding document for new members at our company

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published