https://github.com/mirajhad/you-don-t-know-git
This repository contains hard-to-find Git commands for various use cases.
https://github.com/mirajhad/you-don-t-know-git
Last synced: 2 months ago
JSON representation
This repository contains hard-to-find Git commands for various use cases.
- Host: GitHub
- URL: https://github.com/mirajhad/you-don-t-know-git
- Owner: mirajhad
- License: mit
- Created: 2025-03-24T21:33:40.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-24T21:54:12.000Z (3 months ago)
- Last Synced: 2025-03-24T22:29:25.576Z (3 months ago)
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# You-Don-t-Know-Git
1. Git to discard uncommitted changes in your working directory
```
git restore .```
2. Moves the last commit back to the staging area (index), keeping all changes.```
git reset --soft HEAD~```
3. Moves the last commit back to the staging area (index), Discard all changes.```
git reset --hard HEAD~
```
4. Deletes a local branch named branch_name.```
git branch -d branch_name```
5. Force Delete a Branch (If Not Merged):```
git branch -D branch_name```
6. Delete a Remote Branch:```
git push origin --delete branch_name```
7. List both local & remote branches:```
git branch -a```
8. Prunes (removes) local references to remote branches that no longer exist on the remote.```
git fetch --prune```
9. Quickly Switch to the Previous Branch```
git checkout -
```
10. Show a Visual Branch Tree```
git log --oneline --graph --all
```
11. Search Commit Messages```
git log --grep="bugfix"
```
12. Configures Git to use Windows' built-in SSL/TLS (Schannel) instead of OpenSSL```
git config --global https.sslBackend schannel
```
13. Trigger the CI/CD pipeline with a blank commit
```
git commit --allow-empty -m 'Empty commit'
```
14. Adding a Git subtree to your repository
```
git remote add -f eCommerceSolution.OrdersService https://github.com/mirajhad/eCommerceSolution.OrdersService.git
git subtree add --prefix=eCommerceSolution.OrdersService eCommerceSolution.OrdersService main --squash```
15. visualizing Git history
```
gitk
```