Code Monkey home page Code Monkey logo

soum-ik / git-usecase Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 2 KB

Git is a distributed version control system designed to track changes in source code during software development. It allows multiple developers to collaborate on projects efficiently, managing changes, merging work, and tracking revisions. Git provides a robust set of commands for tasks like branching, merging, committing, and remote repository int

commads git github githubactions

git-usecase's Introduction

Git Commands

Here are some useful Git commands for version control:

Configuration

  • git config --global user.name "Your Name": Set your username globally.
  • git config --global user.email "[email protected]": Set your email globally.
  • git config --list: List all the settings Git can find.

Initialization

  • git init: Initialize a new Git repository locally.
  • git clone <repository_url>: Clone a repository from a URL.

Basic Commands

  • git add <file_name>: Add a specific file to the staging area.
  • git add . or git add --all: Add all changes to the staging area.
  • git commit -m "Commit message": Commit changes with a message.
  • git status: Check the status of the working directory and staging area.
  • git diff: Show changes between commits, commit and working tree, etc.

Branching and Merging

  • git branch: List all the branches in the repository.
  • git branch <branch_name>: Create a new branch.
  • git checkout <branch_name>: Switch to a specific branch.
  • git merge <branch_name>: Merge a branch into the current branch.
  • git branch -d <branch_name>: Delete a branch.

Remote Repository

  • git remote add <remote_name> <remote_url>: Add a new remote repository.
  • git remote -v: List all remote repositories.
  • git pull <remote_name> <branch_name>: Fetch changes from a remote repository and merge.
  • git push <remote_name> <branch_name>: Push changes to a remote repository.
  • git push -u <remote_name> <branch_name>: Push changes and set the upstream branch.

Undoing Changes

  • git reset <file_name>: Unstage a file while retaining the changes.
  • git reset --hard: Discard all changes in the working directory and staging area.
  • git revert <commit_hash>: Revert a commit by creating a new commit.

History

  • git log: Display commit history.
  • git log --oneline: Compact commit history.
  • git log --graph --decorate --oneline: Graphical commit history.
  • git reflog: Show a log of changes to the repository's HEAD.

Miscellaneous

  • git stash: Stash changes in a dirty working directory.
  • git stash apply: Apply stashed changes to the working directory.
  • git clean -n: Dry run to show which files will be removed with git clean -f.
  • git help: Get help on any Git command.

If you find this repository helpful, please consider giving it a star.

git-usecase's People

Contributors

soum-ik avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.