Install Homebrew
Works on Linux and macOS now 👏.
|
|
Many commands expect powershell, which runs on macOS and Linux as well. Just run brew install powershell
to grab it and most of this will work without any further changes unless specified.
Tools I’ve Relied On
CLI
VSCode
GitHub
Git Aliases
Everyone has their own brand of craziness with git aliases.
Here’s a few I’ve found helpful.
Azure DevOps Boards
This one will create an autocompleted ready to go pull request in azure repos using the last commit title and description. If you create your commit correctly for the last one, this will ensure no extra rework required to generate the title and body of the PR, as well as the cleaned up squash message on approval.
Install the Azure CLI and the devops
extension will be installed automatically upon using: brew install az
|
|
|
|
General Commit
You only live once…rebase and sync from origin, commit all your changes, and generate a commit message using PowerShell NameIt module.
Install module via: Install-Module Nameit -Scope CurrentUser
Install gitversion via: dotnet tool install --global GitVersion.Tool
|
|
For quickly amending the last commit on your own private branch, you can combine these two commands to overwrite your branch with the latest changes instead of versioning.
|
|
Cleanup
Command | Code |
---|---|
remove file from git without deleting | git rm --cached ./filepath.txt |
remove directory from git without deleting | git rm --cached -r ./mydirectory |
Remove files already committed
|
|
Renaming Branch
If you want to align with GitHub recommended naming of changing master
to main
, then this command will help you fix the local branches to correctly point master
to the remote main
branch.
|
|
You can configure this as a VSCode snippet for quick access by including this:
|
|
Working With Changes
All the commits the branch has that the master doesn’t. 1
|
|
Cleanup Tags
- Remove tags on remote first:
git push --no-verify --delete MyTagName
- Remove every local tag in your repo:
git tag -d $(git tag)
- Pull latest tags:
git fetch origin --prune --prune-tags
Forks
- Add remote for fork, typically covered with the
upstream
name: `git remote add upstream {repolink}. - Reset a forked branch to match the remote upstream resource:
git reset --hard upstream/master
Resources
Source | Description |
---|---|
GitFixUm 2 | FlowChart Style Help |
Webmentions
(No webmentions yet.)