Reputation: 51039
I found an example on how to delete a commit but it includes git log in the following format
Number Hash Commit Message Author
1 2c6a45b (HEAD) Adding public method to access protected method Tom
2 ae45fab Updates to database interface Contractor 1
3 77b9b82 Improving database interface Contractor 2
4 3c9093c Merged develop branch into master Tom
5 b3d92c5 Adding new Event CMS Module Paul
6 7feddbb Adding CMS class and files Tom
7 a809379 Adding project to Git Tom
When I issue the git log
command I'm getting log in another format and without the numbers (which are required by the task).
How to get git log
with numbers?
Upvotes: 9
Views: 5213
Reputation: 767
If you have a big list of commits, you may want to use less along with nl.
git log --oneline | nl | less
I use this to combine a set of commits in a single commit using git reset --soft
Upvotes: 0
Reputation: 44952
You could combine the nl
command with git log --oneline
to enumerate output lines. It's far from ideal but if you are just looking for the line numbers:
$ git log --oneline | nl
1 91236f3 Message
2 a611069 Message
3 f2813e7 Message
4 01b59e4 Message
5 2343455 Message
Upvotes: 16