Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In GIT, obtain commits using git log with path

I would like to obtain the last 10 commits using git log specifying the path of my repository. I used the option -path but I have "is outside repository" error

 git log --no-merges -10 -p /home/my_folder/git/repo

 fatal: /home/my_folder/git/repo: '/home/my_folder/git/repo' is outside repository

The comand is running for example in the folder /home

like image 822
user3472065 Avatar asked Jul 02 '15 07:07

user3472065


1 Answers

Git assumes that the current working directory is inside the repository you want to operate on. When running a git command from outside the repository directory hierarchy, you can use the global -C option to git to specify which repository to use:

git -C /home/my_folder/git/repo log --no-merges -10 -p

Usually it's probably easier to simply cd to your repository before running git commands.

like image 84
Sven Marnach Avatar answered Oct 01 '22 00:10

Sven Marnach