To display the history of changes affecting a specific directory in a version control system (VCS) like Git, you can use the following commands:
For Git
1. Using git log:
You can use the git log command to display commit history specific to a directory. Navigate to your repository in the terminal and run:
git log -- path/to/directory
This command shows the commit history for the specified directory. You can add various flags to customize output, such as:
- --oneline: Display each commit in a single line.
- --stat: Show the changes made in each commit.
- --follow: If you want to include history for files that might have changed names:
git log --follow -- path/to/directory
2. Using git diff:
If you want to see the changes made to files within the directory between specific commits, you can use:
git diff commit1 commit2 -- path/to/directory
3. Using git blame:
To see the last modification for each line of each file in a directory, you can use:
git blame path/to/directory/*
For Other Version Control Systems
- Mercurial (hg):
You can use:
hg log path/to/directory
- Subversion (svn):
You can use:
svn log path/to/directory
Each version control system has its commands and ways to filter changes, so refer to the respective documentation for more advanced queries and options.
Summary
In Git, the primary tool is git log, possibly augmented with options like --oneline, --stat, and --follow, to effectively view the history of a specific directory's changes. For other VCS, equivalent commands exist that achieve similar results.