Skip to content

Latest commit

 

History

History

git

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Git

Git Logo

The modern standard for version control

🚀 About

In this HashiQube DevOps lab, you'll get hands-on experience with Git, the world's most popular version control system.

Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. It's easy to learn, has a small footprint, and offers lightning-fast performance.

Git outperforms traditional SCM tools like Subversion, CVS, Perforce, and ClearCase with powerful features such as:

  • Efficient local branching
  • Convenient staging areas
  • Flexible workflows
  • Distributed development model

💻 GitHub Desktop Client

To make working with Git even easier, you can use GitHub Desktop, a user-friendly Git client that simplifies your development workflow.

GitHub Desktop Screenshot

GitHub Desktop provides a user-friendly interface for Git operations

Download GitHub Desktop

GitHub Desktop helps you:

  • Focus on your work instead of fighting with Git syntax
  • Visualize changes with an intuitive interface
  • Easily switch between branches
  • Simplify common Git tasks with a few clicks
  • Perfect for both beginners and experienced users

📑 Git Cheat Sheet

To help you quickly learn the most common Git commands, here's a handy cheat sheet you can use as a wallpaper:

Git Cheat Sheet Wallpaper

Git Cheat Sheet - A helpful reference for common Git commands

🛠️ Essential Git Commands

Getting Started

# Initialize a new Git repository
git init

# Clone an existing repository
git clone https://github.com/username/repository.git

Making Changes

# Check status of your working directory
git status

# Add files to staging area
git add filename.txt      # Add specific file
git add .                 # Add all files

# Commit changes
git commit -m "Descriptive message"

# Commit all tracked changes without a separate add step
git commit -am "Descriptive message"

Working with Branches

# List all branches
git branch

# Create a new branch
git branch branch-name

# Switch to a branch
git checkout branch-name

# Create and switch to a new branch in one command
git checkout -b branch-name

# Merge a branch into your current branch
git merge branch-name

Remote Repositories

# Add a remote repository
git remote add origin https://github.com/username/repository.git

# Push changes to remote
git push origin branch-name

# Pull changes from remote
git pull origin branch-name

# Fetch changes without merging
git fetch origin

🔄 Common Git Workflows

Feature Branch Workflow

  1. Create a branch for a new feature: git checkout -b new-feature
  2. Make changes and commit: git commit -am "Add new feature"
  3. Push to remote: git push origin new-feature
  4. Create a pull request for review
  5. Merge into main branch after approval

Gitflow Workflow

  • main branch contains production code
  • develop branch for ongoing development
  • Feature branches for new features
  • Release branches for release preparation
  • Hotfix branches for urgent production fixes

🔗 Additional Resources