Git Tip
Git log
Detailed log
git log
Hash + subject line
git log --oneline
Group commit subject by username.
git shortlog
Git config
Show git config
git config -l
Only local repository
git config --local -l
Set user name and email for local
git config --local user.name "Your Name Here"
git config --local user.email "your@email.com"
Set user name and email to global ~/.gitconfig
:
git config --global user.name "Your Name Here"
git config --global user.email "your@email.com"
Set remote url
git remote set-url origin git@github.com:username/repo-name.git
Git branches
If mater branch was renamed on GitHub
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
Commit Message Format
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
Commit Message Type
Must be one of the following:
- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
- docs: Documentation only changes
- feature: A new feature
- fix: A bug fix
- perf: A code change that improves performance
- refactor: A code change that neither fixes a bug nor adds a feature
- revert: This reverts commit
<hash>
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- test: Adding missing tests or correcting existing tests