Giter Club home page Giter Club logo

setting-up-aliases-on-mac's Introduction

Setting up (Git) aliases on MAC

.bash_profile

In case you're not aware, there's a hidden file in your Mac’s user directory named as .bash_profile. This file mostly allows you to configure your command line interface the way you need it. Basically, you can change the terminal prompt, colors of text, add aliases to functions you use all the time, and so much more.

You should know right now that this file has a '.' at the beginning of its name which makes it invisible. So you won't be able to find it in your Mac's Finder. To view invisible files in the Terminal you can use the following command:

ls -al

Setting up aliases

Step 1

  • Navigate to the User Directory where the .bash_profile file is located. Type:
    ~/.bash_profile
    

Step 2

Open the .bash_profile file using the following command:

nano .bash_profile
  • This command will open the .bash_profile document (or create it if it doesn’t already exist) in the Nano text editor.

Step 3

Use the following command to create the alias:

alias gs='git status' 
  • So whenever you type gs in your terminal, it will be replaced by git status.
  • You can change the name (gs) to anything you'd like.
  • Let's create aliases for some of the basic Git commands
alias gs='git status'
alias ga='git add .'
alias gc='git commit -m'
alias gpom='git pull origin master'
alias gpm='git push origin master'

Step 4

  • To Save the changes, press ctrl+o and then press Enter (Return).
  • Next, press ctrl+x to Exit.

Step 5

  • Note: If we're making any changes to the .bash_profile file, we need to compile the file.
  • To that, we just type:
source ~/.bash_profile

That's it, you can start using the aliases now. Similarly, you can create aliases for anything you want.

setting-up-aliases-on-mac's People

Contributors

nigeldcruz avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.