https://github.com/zackaj/alias
step by step guide on how to set up a git bash alias with arguments on windows
https://github.com/zackaj/alias
Last synced: 28 days ago
JSON representation
step by step guide on how to set up a git bash alias with arguments on windows
- Host: GitHub
- URL: https://github.com/zackaj/alias
- Owner: zackAJ
- Created: 2023-08-12T14:00:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-12T17:54:00.000Z (over 1 year ago)
- Last Synced: 2025-02-13T20:15:30.523Z (3 months ago)
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# alias
step by step guide on how to set up a git bash alias with arguments globaly on Windows## Requirements
- Windows OS
- git installed
- git bash---
## table of content
- [The Goal](#the-goal)
- [Command Setup](#command-setup)
- [Steps](#steps)---
## The Goal
the goal of this example is to clone any repo from your GitHub profile,
you can apply the same logic and steps to setup any aliasGoing from this :
```sh
git clone https://github.com/zackAJ/
```To this :
```sh
clone
```---
## Command Setup
in this example, I'm using my own GitHub profile URL: `https://github.com/zackAJ/`don't forget to replace it with **your own URL**.
```sh
alias clone='fn(){ git clone https://github.com/zackAJ/$1; } ; fn $1'
```
where:
- `clone` is the name of the alias, you can name this to anything you like.
- `$1` is going to be the argument that we pass to the function AKA our `repo name`.once your command is ready copy it and follow these steps [Steps](#steps)
---
## Steps
1- go to `C:\Program Files\Git\etc\profile.d`

2- open `aliases.sh` with a text editor of choice `as an administrator`
3- paste your alias to add it to the list of global aliases and save

4- to check if the alias was added open git bash and enter the `alias` command
```sh
alias
```
5- test the alias by adding a repo name (my repo's name is alias)
```sh
clone alias
```
and that's it ! more copy-paste ready aliases are gonna be added soon.