Add shortcuts information for Windows PowerShell (#263)

This commit is contained in:
Tommy Williams 2018-12-11 10:29:13 -07:00 committed by Richard Littauer
parent 73547ca942
commit 8e697833ae
1 changed files with 24 additions and 7 deletions

View File

@ -123,11 +123,13 @@ All commands should work for at least git version 2.13.0. See the [git website](
- [I want to add command line coloring for Git](#i-want-to-add-command-line-coloring-for-git) - [I want to add command line coloring for Git](#i-want-to-add-command-line-coloring-for-git)
- [I've no idea what I did wrong](#ive-no-idea-what-i-did-wrong) - [I've no idea what I did wrong](#ive-no-idea-what-i-did-wrong)
- [Git Shortcuts](#git-shortcuts) - [Git Shortcuts](#git-shortcuts)
- [Other Resources](#other-resources) - [Git Bash](#git-bash)
- [Books](#books) - [PowerShell on Windows](#powershell-on-windows)
- [Tutorials](#tutorials) - [Other Resources](#other-resources)
- [Scripts and Tools](#scripts-and-tools) - [Books](#books)
- [GUI Clients](#gui-clients) - [Tutorials](#tutorials)
- [Scripts and Tools](#scripts-and-tools)
- [GUI Clients](#gui-clients)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
@ -1705,6 +1707,8 @@ Using `git reset` it is then possible to change master back to the commit it was
<a name="git-shortcuts"></a> <a name="git-shortcuts"></a>
## Git Shortcuts ## Git Shortcuts
### Git Bash
Once you're comfortable with what the above commands are doing, you might want to create some shortcuts for Git Bash. This allows you to work a lot faster by doing complex tasks in really short commands. Once you're comfortable with what the above commands are doing, you might want to create some shortcuts for Git Bash. This allows you to work a lot faster by doing complex tasks in really short commands.
```sh ```sh
@ -1713,8 +1717,21 @@ alias sq=squash
function squash() { function squash() {
git rebase -i HEAD~$1 git rebase -i HEAD~$1
} }
```` ```
copy those commands to your .bashrc or .bash_profile.
Copy those commands to your .bashrc or .bash_profile.
### PowerShell on Windows
If you are using PowerShell on Windows, you can also set up aliases and functions. Add these commands to your profile, whose path is defined in the `$profile` variable. Learn more at the [About Profiles](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles) page on the Microsoft documentation site.
```powershell
Set-Alias sq Squash-Commits
function Squash-Commits {
git rebase -i HEAD~$1
}
```
# Other Resources # Other Resources