rahul3002 / Git-Guide

Welcome to the Git-Guide repository! This repository contains comprehensive resources for learning and mastering Git, a popular version control system used by developers worldwide.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Git-Guide

Git Guide is a comprehensive resource designed to help developers master Git, the popular version control system. This guide covers everything from the basics of Git to more advanced commands, providing users with the knowledge they need to work with Git effectively. Whether you're new to Git or have been using it for a while, Git Guide will provide you with the information you need to manage your code repositories with confidence. With step-by-step tutorials, helpful examples, and a range of useful tips and tricks, Git Guide is the ultimate resource for anyone looking to improve their Git skills. So, if you're ready to take your Git knowledge to the next level, start exploring Git Guide today!

Git Commands

Initializing a Repository

  1. git init: Initialize a Git repository in the current directory.

Cloning a Repository

  1. git clone [repository URL]: Clone a remote repository to the local machine.

Staging and Committing Changes

  1. git add [file or directory name]: Stage changes for the next commit.

  2. git commit -m "commit message": Commit staged changes with a descriptive message.

Checking the Status of the Repository

  1. git status: Check the current status of the repository, including staged and unstaged changes.

Viewing Differences

  1. git diff: View differences between the current code and the last commit.

Viewing Commit History

  1. git log: View the commit history for the repository.

Managing Branches

  1. git branch: List all branches in the repository.

  2. git branch [branch name]: Create a new branch with the specified name.

  3. git checkout [branch name]: Switch to the specified branch.

  4. git merge [branch name]: Merge the specified branch into the current branch.

Pulling and Pushing Changes

  1. git pull [remote name] [branch name]: Fetch and merge changes from a remote repository.

  2. git push [remote name] [branch name]: Push local changes to the specified remote repository.

Stashing Changes

  1. git stash: Stash changes that have not been staged or committed.

  2. git stash apply: Apply the latest stash to the current branch.

  3. git stash list: List all stashes in the repository.

  4. git stash pop: Apply the latest stash and remove it from the stash list.

  5. git stash drop: Remove the latest stash from the stash list.

Unstaging and Reverting Changes

  1. git reset [file or directory name]: Unstage changes for the specified file or directory.

  2. git checkout [commit ID] [file or directory name]: Revert changes for the specified file or directory to the state at the specified commit.

  3. git revert [commit ID]: Create a new commit that reverses changes from the specified commit.

Fetching Changes

  1. git fetch [remote name]: Fetch changes from a remote repository without merging them into the local branch.

Managing Remote Repositories

  1. git remote -v: List all remote repositories associated with the local repository.

  2. git remote add [remote name] [remote URL]: Add a new remote repository to the local repository.

  3. git remote rm [remote name]: Remove the specified remote repository from the local repository.

Tagging Commits

  1. git tag [tag name]: Add a tag to the current commit with the specified name.

  2. git tag -d [tag name]: Delete the specified tag from the repository.

  3. git show [tag name]: View information about the specified tag, including the commit it is associated with.

Viewing Branch References

  1. git reflog: View a list of all branch references and HEAD updates in the repository.

Ignoring Files

  1. .gitignore: Create a .gitignore file in the root of the repository to specify files or directories that should be ignore

About

Welcome to the Git-Guide repository! This repository contains comprehensive resources for learning and mastering Git, a popular version control system used by developers worldwide.