History or log of commands executed in Git

Is there a way to track the commands I used in Git on Windows? I want to see all the commands that I applied in my repository.

I want to go back to the history of the teams and find out which of them caused the problem, if it happened.

Seeing the history of commits would be one thing, but are they tracked to keep a history of other actions, such as creating a branch or adding a remote one?

+45
git
Sep 15 '11 at 18:08
source share
6 answers

git will display commit changes that affect the index, such as git rm . It does not keep a log of all the git commands that you execute.

However, a large number of git commands affect the index in some way, for example, creating a new branch. These changes will appear in the commit history, which you can view with git log .

However, there are destructive changes that git cannot track, such as git reset .

So, to answer your question, git does not store the absolute history of the git commands that you executed in the repository. However, you can often interpolate the command that you executed using the commit history.

-one
Sep 15 '11 at 18:14
source share

You can view the history using git-reflog ( example here ):

 git reflog 
+98
Sep 15 '11 at 18:19
source share

The log of your commands may be available in the history of your shell.

 history 

If you’re looking at a list of commands that are not flying for you, export the list to a file.

 history > path/to/file 

You can restrict the exported dump to only display commands with "git" by linking it to grep

 history | grep "git " > path/to/file 

A story may contain lines formatted as such

 518 git status -s 519 git commit -am "injects sriracha to all toppings, as required" 

Using the number, you can re-execute the command with an exclamation mark

 $ !518 git status -s 
+28
Jan 19 '13 at 18:03
source share

If you are using CentOS or another flavor of Linux, just do Ctrl + R at the prompt and type git .

If you continue to delete Ctrl + R , this will lead to a reverse search in your history for commands starting with git

+7
Mar 19 '14 at 17:13
source share

If you use Windows PowerShell, you can type "git" and press F8. Keep pressing F8 to see all your git commands.

Or, if you use cygwin, you can do the same with ^ R.

+5
Sep 15 '11 at 18:38
source share

Enter your terminal history . This is not technically git, but I think this is what you want.

0
Sep 08 '17 at 1:03 on
source share



All Articles