10

I edited my $Home .bash_profile to include some git alias commands. I am rather new to this and I can't figure out what went wrong.

.bash_profile

alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gd='git diff'
alias go='git checkout '
alias gk='gitk --all&'
alias gx='gitx --all'

alias got='git '
alias get='git '

PS1="\u$ "
alias ll="ls -lahG"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && \
. "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && \
. "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && \
. "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && \
. "$HOME/.rvm/scripts/rvm"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

[[ -s "$HOME/.rvm/scripts/rvm" ]] && \
. "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && \
. "$HOME/.rvm/scripts/rvm"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

I can't seem to understand what I did wrong. Any ideas?

[EDIT] Just wanted to mention that the part that I added is from PS1 up. For example alias ll = "ls -lahG" works well. The ones above do not.

[EDIT2] I tried to user gs(){ git status "$*"; } instead but that didn't seem to do the trick.

[EDIT3] The problem was that I had to source ~/.profile. What I ended up doing is putting it in the ~/.bashrc file and source that file at Sputnick's recommendation.

6
  • do you restart the terminal or execute . ~/.bash_profile. I see no error at the first look. Commented Oct 1, 2012 at 16:04
  • What went wrong is that you used an alias. Use functions instead. eg: gs(){ git status "$*"; } Commented Oct 1, 2012 at 16:04
  • if you type alias into the prompt what the prompt returns? Commented Oct 1, 2012 at 16:07
  • @Burntime alias rvm-restart='rvm_reload_flag=1 source '\''/Users/MLP/.rvm/scripts/rvm'\''' Not sure what that means Commented Oct 1, 2012 at 16:12
  • @WilliamPursell I tried that but it didn't seem to do the trick. One of the allias that I have works fine though so I don't see why using alias would be a problem... Commented Oct 1, 2012 at 16:13

1 Answer 1

22

You should use ~/.bashrc and not ~/.bash_profile for aliases.

~/.bashrc is for interactive use, see http://mywiki.wooledge.org/DotFiles & http://wiki.bash-hackers.org/scripting/bashbehaviour

And most important thing, you should source the modified file with :

. ~/.bashrc

or

source ~/.bashrc
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.