AI Engineering 6 min read Mar 14, 2026

Learning Git and GitHub: Step-by-Step Guide for Beginners

R
Rivira Tech Engineering Team
Practical AI, Taught & Built
Git and GitHub workflow

Git and GitHub are essential tools for software development. In this project, we simulate a one-year experience in a company using Git and GitHub—starting from beginner concepts and progressing to expert workflows.

Step 1: Initializing a Git Repository
  • Create a project directory and navigate into it.
  • Initialize a Git repository:
git init

This command creates a new Git repository in the current directory.

Step 2: Creating a GitHub Repository
$ git remote add origin https://github.com/<username>/<repository>.git
$ git push -u origin master
Step 3: Making Changes and Committing
  • Modify project files.
  • Stage and commit changes:
$ git add .
$ git commit -m "Initial commit"

$ git add stages changes, and $ git commit saves them with a message.

Step 4: Branching
  • Create a new branch to work on features independently:
$ git checkout -b feature1
Step 5: Merging
  • Merge the feature branch into the main branch:
$ git checkout master
$ git merge feature1
Step 6: Pull Requests
  • Create a pull request on GitHub.
  • Review, approve, and merge changes.
Step 7: Tagging
  • Mark important releases:
$ git tag v1.0

This creates a version tag at the current commit.

Step 8: Collaborating with Others
  • Fork repositories to contribute.
  • Clone repositories locally:
$ git clone https://github.com/<username>/<repository>.git

This creates a local copy, allowing offline development and collaboration.

Step 9: Managing Conflicts

Conflicts occur when multiple contributors modify the same file. $ git highlights conflicts using markers:

<<<<<<<
=======
>>>>>>>

Resolve conflicts, then stage and commit:

$ git add <file>
$ git commit -m "Resolved conflict in <file>"
Step 10: Advanced Git Commands

$ git stash – Temporarily saves uncommitted changes
$ git rebase – Reapplies commits on a new base
$ git cherry-pick – Applies a specific commit to another branch

Back to All Articles
Share: