[kwlug-disc] Using the alias command with the Git Command Line Interface
Adam Glauser
adamglauser at gmail.com
Wed Feb 14 11:06:33 EST 2018
Thanks for sharing this John. For what it's worth, I've been using Git for
years now, and I strongly prefer the CLI over any GUI I've used. That being
said, I do use GUI tools for certain operations. For example, see `git
mergetool`. My preferred tool is KDiff3 (which is available on the other OS
as well).
My approach to your problem is to use environment variables. An advantage
of this approach is that you can then refer to those paths in a variety of
use cases.
# ~/.profile
export P_A_DIR=/c/Users/user/projects/projectA
export P_B_DIR=/c/Users/user/projects/projectB
You can then do things like:
$ cd $P_A_DIR
$ diff $P_A_DIR/path/to/file $P_B_CODE/path/to/file
In particular, I find this handy for referring to locations on remote
boxes, where I may not be able to use aliases or remote env. vars. easily.
$ scp $P_A_DIR/path/to/file user at server:$P_A_TEST/path/to/file
or
$ scp $P_A_DIR/path/to/file user at server:$P_A_RELEASE/path/to/file
Hope this helps,
Adam
On Wed, Feb 14, 2018 at 10:36 AM John Johnson <jvj at golden.net> wrote:
> Update
> A while ago I was informed about the use of alias command.
> My Bad: I had forgotten about the alias command, as I used it back when
> was UNIX sysadm, many eons ago.
>
> While my application is not in Linux what I have shown below shows how I
> am using the alias command with the git command window.
> The same can apply to Linux.
>
> In the other OS, I have placed .bashrc (shown below) in the git home
> directory /c/Users/user/.
> I have a number of projects, each with their own development directory
> and git repository.
> In the git command window, I use the alias commands shown below to
> define shortcuts that will put me in the development directory for the
> current project.
>
> # .bashrc
> # created 20180211
> alias cdprojectA="cd /c/Users/user/projects/projectA"
> alias cdprojectB="cd /c/Users/user/projects/projectB"
> alias cdprojectC="cd /c/Users/user/projects/projectC"
> # done
>
> Next: Study & use the git control files: .gitignore and .ignore.
>
> And yes! At this time, I prefer to use git from the command line window.
> Using the git gui will come later.
>
> JohnJ
>
>
> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20180214/e1de2d94/attachment.htm>
More information about the kwlug-disc
mailing list