How to use the command 'git local-commits' (with examples)
The ‘git local-commits’ command is a part of the ‘git-extras’ extension for Git. It allows you to view the local commits that have not been pushed to the remote repository. The command also supports passing additional arguments to the ‘git log’ command for further customization.
Use case 1: Show commits that haven’t been pushed
Code:
git local-commits
Motivation: This use case is helpful when you want to see a list of the commits made in your local repository that have not been pushed to the remote repository yet. It can help you track your work and identify which changes you need to push.
Explanation: No additional arguments are provided in this use case. The ‘git local-commits’ command is executed without any extra options, resulting in a simple output of local commits.
Example output:
commit e893bc8fe02e448e0a7c96b5889e89b5c9747efc
Author: John Doe <john@example.com>
Date: Mon Jan 10 12:34:56 2022 +0100
Update README.md
commit 9e17f1b89cf58311169506c30dbb8a1cb2f93199
Author: Jane Smith <jane@example.com>
Date: Fri Jan 7 09:12:34 2022 +0100
Add new feature
commit 674527a9b0e8794e75850e5669928317f225728e
Author: John Doe <john@example.com>
Date: Tue Jan 4 14:25:59 2022 +0100
Fix bug #123
...
Conclusion: The ‘git local-commits’ command is a useful tool for keeping track of your local commits that have not been pushed to the remote repository yet. It simplifies the process of identifying and managing your work before pushing it to the shared repository.