Skip to content

Git Workflow

๐Ÿง  DexaMinds Git & GitHub Training Guide (Using Git Bash)

๐Ÿ”ง 1. Initial Setup

โœ… Install Git

  • Download from: https://git-scm.com/downloads

โœ… Configure Git

git config --global user.name "Your Name"
git config --global user.email "your.email@dexaminds.com"
git config --global core.editor "code --wait"

โœ… Verify Configuration

git config --list

๐Ÿ“ 2. Repository Management

โœ… Clone a Repository

git clone https://github.com/your-org/repo-name.git

โœ… Create a New Repository (Local)

mkdir my-project
cd my-project
git init
git remote add origin https://github.com/your-org/repo-name.git
git push -u origin main

โŒ Delete a Local Repository

rm -rf my-project

๐ŸŒฟ 3. Branching Operations

โœ… Create a New Branch

git checkout -b feature/branch-name

๐Ÿ” Switch Between Branches

git checkout main

๐Ÿ”€ Merge a Branch

git checkout main
git merge feature/branch-name

โŒ Delete a Branch

git branch -d feature/branch-name
git branch -D feature/branch-name

๐Ÿ” 4. Commit Workflow

This section outlines the standard Git commit workflow that every developer at DexaMinds should follow:

๐Ÿงญ Step-by-Step Commit Workflow

  1. Pull latest changes from the remote branch: bash git pull origin branch-name

  2. Check status of your working directory: bash git status

  3. Stage the changes you want to commit: bash git add file-name git add .

  4. Review staged changes (optional but recommended): bash git diff --cached

  5. Commit with a meaningful message: bash git commit -m "feat: add login validation for user form"

  6. Push your changes to the remote branch: bash git push origin branch-name

  7. Create a Pull Request on GitHub and request review.


๐Ÿ” 5. Working with Pull Requests (PRs)

โœ… Create a PR

  1. Push your branch to GitHub.
  2. Go to GitHub โ†’ Open your repo โ†’ Click "Compare & pull request".
  3. Add title, description, reviewers, and submit.

โœ… Review a PR

  • Use GitHub UI to comment, approve, or request changes.

โœ… Merge a PR

  • After approval, click "Merge pull request" on GitHub.

๐Ÿงช 6. Best Practices

  • Use meaningful branch names: feature/login-page, fix/api-error
  • Commit often with clear messages.
  • Always pull before pushing.
  • Delete merged branches to keep repo clean.
  • Use .gitignore to avoid committing unnecessary files.

๐Ÿ› ๏ธ Common Git Commands Cheat Sheet

Action Command
Initialize repo git init
Clone repo git clone <url>
Check status git status
Stage file git add file-name
Stage all git add .
Unstage file git reset file-name
Commit git commit -m "message"
Amend last commit git commit --amend
View commit history git log
View one-line log git log --oneline
Create branch git checkout -b branch-name
Switch branch git checkout branch-name
Delete branch git branch -d branch-name
Merge branch git merge branch-name
Pull changes git pull origin branch-name
Push changes git push origin branch-name
View remote git remote -v
Add remote git remote add origin <url>
Remove remote git remote remove origin