Skip to content
/ alias Public

step by step guide on how to set up a git bash alias with arguments on windows

Notifications You must be signed in to change notification settings

zackAJ/alias

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 

Repository files navigation

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 of this example is to clone any repo from your GitHub profile, you can apply the same logic and steps to setup any alias

Going from this :

git clone https://github.com/zackAJ/<project-name>

To this :

clone <project-name>

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.

 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

1- go to C:\Program Files\Git\etc\profile.d

image

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

image

4- to check if the alias was added open git bash and enter the alias command

alias

image

5- test the alias by adding a repo name (my repo's name is alias)

clone alias

image

and that's it ! more copy-paste ready aliases are gonna be added soon.

About

step by step guide on how to set up a git bash alias with arguments on windows

Resources

Stars

Watchers

Forks