When I execute this git command: git rev-list --since=2015-03-01
, it always says
Invalid object name 'usage'.
I don't know the format of since or after. I'm using Java ProcessBuilder to execute the command. Any help appreciated!
The code:
command=new String[] {"git", "rev-list", "--since=2015-06-22", "--pretty=oneline"};
ProcessBuilder processBuilder = new ProcessBuilder(command);`
You are getting an error about usage
because you're using arguments that are not valid for rev-list
, and git will print a usage summary as a result. The first word it gets back is usage
, which it is complaining about.
$ git rev-list --since=2015-06-22 --pretty=oneline
usage: git rev-list [OPTION] <commit-id>... [ -- paths... ]
limiting output:
--max-count=<n>
--max-age=<epoch>
... and so on.
Based on your current attempt, I gather you are trying to find commits after a certain date, and return them one per line. Since you are using rev-list
instead of log
, you probably want a list of commit objects, not full log entries.
The main problem with your command is that rev-list
expects a commit ID or other reference as its starting point, and you aren't supplying one. That's easy, just point it to HEAD
.
This will give you the commit IDs from HEAD back to the specified date.
git rev-list --since=2015-06-22 HEAD
Or specified in the syntax you are using for Java,
command=new String[] {"git", "rev-list", "--since=2015-06-22", "HEAD"};