Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Git Commands README

Introduction

Welcome to the Git Commands repository! This README provides an overview of essential Git commands to help you get started with version control and collaborative development.

Table of Contents

  1. Git Basics
  2. Repository Setup
  3. Branching
  4. Committing Changes
  5. Updating Changes
  6. Merging
  7. Remote Repositories
  8. Undoing Changes
  9. Git Extras
  10. Resources

Git Basics

Initialize a Repository

git init

Clone a Repository

git clone <repository-url>

Repository Setup

Add Changes to Staging

git add <file1> <file2> ...

Commit Staged Changes

git commit -m "Commit message"

Branching

Create a New Branch

git branch <branch-name>

Switch to a Branch

git checkout <branch-name>

Create and Switch to a Branch

git checkout -b <branch-name>

Committing Changes

View Changes

git status

View Changes in Diff Format

git diff

Updating Changes

Fetch Latest Changes

git fetch

Pull Latest Changes

git pull

Push Changes to Remote

git push

Merging

Merge Branch into Current Branch

git merge <branch-name>

Remote Repositories

Add a Remote Repository

git remote add <remote-name> <remote-url>

Fetch Changes from a Remote Repository

git fetch <remote-name>

Pull Changes from a Remote Repository

git pull <remote-name> <branch-name>

Undoing Changes

Discard Changes in Working Directory

git checkout -- <file>

Discard Changes in Staging Area

git reset <file>

Undo the Last Commit

git reset --soft HEAD^

Git Extras

View Commit History

git log

View a Specific Commit

git show <commit-hash>

View Remote Branches

git remote show <remote-name>

Resources

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors