https://github.com/muhammadaliashraf/a-list-of-git-commands
This collection includes all essential Git commands to help you manage your repositories effectively.
https://github.com/muhammadaliashraf/a-list-of-git-commands
bigginers git-repository gitcommand gitcommands github github-config help helpdesk learning list listing open-source openai opensource react
Last synced: 20 days ago
JSON representation
This collection includes all essential Git commands to help you manage your repositories effectively.
- Host: GitHub
- URL: https://github.com/muhammadaliashraf/a-list-of-git-commands
- Owner: MuhammadAliashraf
- Created: 2024-12-14T14:45:20.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-12-14T14:47:26.000Z (4 months ago)
- Last Synced: 2025-02-13T06:45:03.011Z (2 months ago)
- Topics: bigginers, git-repository, gitcommand, gitcommands, github, github-config, help, helpdesk, learning, list, listing, open-source, openai, opensource, react
- Homepage:
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Git Commands
============_A list of Git commands_
--___
___### Tell Git who you are
| Description | Command |
| ------- | ----------- |
| Configure the author name.|`git config --global user.name ""`|
| Configure the author email address.|`git config --global user.email `|### Getting & Creating Projects
| Description | Command |
| ------- | ----------- |
| Initialize a local Git repository | `git init` |
| Create a local copy of a remote repository | `git clone ssh://[email protected]//.git` |### Basic Snapshotting
| Description | Command |
| ------- | ----------- |
| Check status | `git status` |
| Add a file to the staging area | `git add ` |
| Add all new and changed files to the staging area | `git add -A` or
`git add .` |
| Commit changes | `git commit -m ""` |
| Remove a file (or folder) | `git rm -r ` |### Inspection & Comparison
| Description | Command |
| ------- | ----------- |
| View changes | `git log` |
| View changes (detailed) | `git log --summary` |
| View changes in one line (briefly) | `git log --oneline` or
`git log --pretty=oneline` or
`git log --pretty=short` |### Undo to previous file
| Description | Command |
| ------- | ----------- |
| List of all commit with commit id and commit message) | `git log --oneline` |
| Return to previous commit | `git checkout` |
| Revert commit (undo one particular commit) | `git revert ` |
| Reset to previous commit (remove history of all commit after ) | `git reset --hard `|
| Stop a file being tracked | `git rm --cached ` |
| Restore a file to a previous commit| `git checkout ` |### Branching & Merging
| Description | Command |
| ------- | ----------- |
| List branches (the asterisk denotes the current branch) | `git branch` |
| List all branches (local and remote) | `git branch -a` |
| Create a new branch | `git branch ` |
| Create a new branch and switch to it | `git checkout -b ` |
| Clone a remote branch and switch to it | `git checkout -b origin/` |
| Rename a local branch | `git branch -m ` |
| Switch to a branch | `git checkout ` |
| Switch to the branch last checked out | `git checkout -` |
| Discard changes to a file | `git checkout -- ` |
| Delete a branch | `git branch -d ` |
| Delete a remote branch | `git push origin --delete ` |
| Preview changes before merging | `git diff ` |
| Merge a branch into the active branch | `git merge ` |
| Merge a branch into a target branch | `git merge ` |
| Stash changes in a dirty working directory | `git stash` |
| Remove all stashed entries | `git stash clear` |### Sharing & Updating Projects
| Description | Command |
| ------- | ----------- |
| Push a branch to your remote repository | `git push origin ` |
| Push changes to remote repository (and remember the branch) | `git push -u origin ` |
| Push changes to remote repository (remembered branch) | `git push` |
| Push changes to remote repository all branch | `git push --all` |
| Push changes to remote repository (Force) | `git push -f` |
| Delete a remote branch | `git push origin --delete ` |
| Update local repository to the newest commit | `git pull` |
| Pull changes from remote repository | `git pull origin ` |
| Add a remote repository | `git remote add origin ssh://[email protected]//.git` |
| Set a repository's origin branch to SSH | `git remote set-url origin ssh://[email protected]//.git` |[follow](https://github.com/MuhammadAliashraf)