DEV Community

Serhat Teker
Serhat Teker

Posted on • Originally published at tech.serhatteker.com on

Git Pull/Push From Another Directory

I wish I knew that earlier, it would save a lot of cd:

$ git -C /dir/you/want/to/pull/push push
# with verbose output
$ git -C /dir/you/want/to/pull/push push -v
Enter fullscreen mode Exit fullscreen mode

NOTICE:

-C flag needs git > 1.8.5

It means that with -C flag you can specify the directory you want to interact
with. I normally go into the directory than push:

$ cd /dir/you/want/to/pull/push && git pull # or push
Enter fullscreen mode Exit fullscreen mode

Not anymore!

All done.


Reference:

Discussion (0)