https://github.com/amanyadav0007/git-and-github-commands
Git and GitHub Commands list
https://github.com/amanyadav0007/git-and-github-commands
git github readme
Last synced: about 1 month ago
JSON representation
Git and GitHub Commands list
- Host: GitHub
- URL: https://github.com/amanyadav0007/git-and-github-commands
- Owner: Amanyadav0007
- Created: 2024-12-29T13:05:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-29T13:08:18.000Z (over 1 year ago)
- Last Synced: 2025-05-29T06:56:33.882Z (about 1 year ago)
- Topics: git, github, readme
- Homepage: https://www.instagram.com/curious_coder_aman/
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Git-and-GitHub-Commands
This table provides a comprehensive list of commonly used Git and GitHub commands, categorized for easy reference.
| **Category** | **Command** | **Description** |
|---------------------------|---------------------------------------|---------------------------------------------------------------------------------|
| **Setup and Configuration** | `git --version` | Check installed Git version. |
| | `git config --global user.name "Your Name"` | Set your Git username. |
| | `git config --global user.email "your.email@example.com"` | Set your Git email address. |
| | `git config --list` | View all Git configurations. |
| | `git help ` | Get help for a specific Git command. |
| **Starting a Repository** | `git init` | Initialize a new Git repository. |
| | `git clone ` | Clone a remote repository to your local machine. |
| **Staging and Committing** | `git add ` | Stage a specific file. |
| | `git add .` | Stage all changes in the repository. |
| | `git status` | Show the status of changes (staged, unstaged, untracked). |
| | `git commit -m "message"` | Commit staged changes with a descriptive message. |
| | `git commit --amend` | Edit the last commit message. |
| **Branching** | `git branch` | List all branches in the repository. |
| | `git branch ` | Create a new branch. |
| | `git checkout ` | Switch to a specific branch. |
| | `git checkout -b ` | Create and switch to a new branch. |
| | `git branch -d ` | Delete a branch locally. |
| **Merging** | `git merge ` | Merge a branch into the current branch. |
| | `git merge --abort` | Abort a merge in case of conflicts. |
| **Viewing Changes** | `git log` | View the commit history. |
| | `git log --oneline` | View the commit history in one-line format. |
| | `git diff` | Show unstaged changes. |
| | `git diff ` | Compare two branches. |
| **Undoing Changes** | `git reset ` | Unstage a file. |
| | `git reset --hard` | Reset to the last commit, discarding all changes. |
| | `git checkout -- ` | Discard changes in a file. |
| **Working with Remotes** | `git remote -v` | List remote repositories. |
| | `git remote add origin ` | Link a local repository to a remote repository. |
| | `git push -u origin main` | Push the main branch to the remote repository and set upstream. |
| | `git pull origin main` | Fetch and merge changes from the remote repository's main branch. |
| | `git fetch` | Download changes from a remote repository without merging. |
| **Tagging** | `git tag` | List all tags in the repository. |
| | `git tag ` | Create a new tag. |
| | `git push origin ` | Push a specific tag to the remote repository. |
| **Collaborative Work** | `git stash` | Save uncommitted changes for later. |
| | `git stash pop` | Apply the latest stashed changes and remove them from the stash list. |
| | `git stash list` | View the list of stashes. |
| | `git rebase ` | Reapply commits from another branch on top of the current branch. |
| **Cleanup** | `git clean -f` | Remove untracked files. |
| **Additional Commands** | `git show ` | Show details of a specific commit. |
| | `git blame ` | View who last edited each line of a file. |
| | `git cherry-pick ` | Apply a specific commit from one branch to another. |
## Notes
- Replace placeholders like ``, ``, ``, ``, and `` with your specific values.
- Use the `--help` option with any Git command to get detailed information about its usage, e.g., `git commit --help`.
---
Feel free to use this table as a quick reference for your Git and GitHub commands!
Follow @curious_coder_aman on Instagram for more coding updates.