Description : Use `git checkout <commit-hash> -- <file>` to view a previous version of a file.
Answer :
To view or restore a file from a previous commit, use `git checkout <commit-hash> -- <file>`. This retrieves the version of the file from the specified commit without affecting other files or the branch's history. Be cautious,asthis will overwrite the current version of the file.
To initialize a Git repository, open your terminal or command prompt, navigate to the directory where you want your Git project to live, and run the command `git init`. This will create a new.git subdirectory that contains all necessary Git files and will start tracking your project.
To initialize a Git repository, open your terminal or command prompt, navigate to the directory where you want your Git project to live, and run the command `git init`. This will create a new.git subdirectory that contains all necessary Git files and will start tracking your project.