List of all Git Commands

Search for a command to run...

No comments yet. Be the first to comment.
As a developer portfolio is best place to Showcase skill, work and Achievements and It's is really valuble for your career. So we need to keep Portfolio updated and Updating portfolio is frustrating, right? So, we've got you covered We are happy to a...

Hello 👋 I am happy to announce my latest project Vdev (A portfolio and resume generator) vdev.in Vdev generate Your portfolio based on info you filled in form and Show your info in a nice-way Here is demo of generated Portfolio Here is demo of resu...

Customize Global npm init default values for next project

Github cli commands A list of Github cli commands feel free to star this Repository DescriptionCommand Initialize a Github repository [default private]gh repo create <name> Initialize a Github public repositorygh repo create <name> --public...

feel free to star this

| Description | Command |
| Configure the author name. | git config --global user.name "<username>" |
| Configure the author email address. | git config --global user.email <email address> |
| Description | Command |
| Initialize a local Git repository | git init |
| Create a local copy of a remote repository | git clone ssh://git@github.com/<username>/<repository-name>.git |
| Description | Command |
| Check status | git status |
| Add a file to the staging area | git add <file-name.txt> |
| Add all new and changed files to the staging area | git add -A or git add . |
| Commit changes | git commit -m "<commit message>" |
| Remove a file (or folder) | git rm -r <file-name.txt> |
| 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 orgit log --pretty=short |
| Description | Command |
| List of all commit with commit id and commit message) | git log --oneline |
| Return to previous commit | git checkout<commit id> |
| Revert commit (undo one particular commit) | git revert <commit id> |
| Reset to previous commit (remove history of all commit after ) | git reset <commit id> |
| Stop a file being tracked | git rm --cached <file/folder> |
| Restore a file to a previous commit | git checkout <file/to/restore> |
| 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 <branch name> |
| Create a new branch and switch to it | git checkout -b <branch name> |
| Clone a remote branch and switch to it | git checkout -b <branch name> origin/<branch name> |
| Rename a local branch | git branch -m <old branch name> <new branch name> |
| Switch to a branch | git checkout <branch name> |
| Switch to the branch last checked out | git checkout - |
| Discard changes to a file | git checkout -- <file-name.txt> |
| Delete a branch | git branch -d <branch name> |
| Delete a remote branch | git push origin --delete <branch name> |
| Preview changes before merging | git diff <source branch> <target branch> |
| Merge a branch into the active branch | git merge <branch name> |
| Merge a branch into a target branch | git merge <source branch> <target branch> |
| Stash changes in a dirty working directory | git stash |
| Remove all stashed entries | git stash clear |
| Description | Command |
| Push a branch to your remote repository | git push origin <branch name> |
| Push changes to remote repository (and remember the branch) | git push -u origin <branch name> |
| Push changes to remote repository (remembered branch) | git push |
| Delete a remote branch | git push origin --delete <branch name> |
| Update local repository to the newest commit | git pull |
| Pull changes from remote repository | git pull origin <branch name> |
| Add a remote repository | git remote add origin ssh://git@github.com/<username>/<repository-name>.git |
| Set a repository's origin branch to SSH | git remote set-url origin ssh://git@github.com/<username>/<repository-name>.git |