In this article you will learn about what are git commits and how you can review pushed and unpushed git commits in specific branch
A git commit
is a unit of change in Git, representing the changes made to a project's codebase at a given point in time. A commit contains the changes made to the files in the repository, as well as a commit message that describes the changes.
To create a new commit, you first need to stage the changes you want to include in the commit using the git add
command. Then, you can run the git commit
command with a message describing the changes:
git add <file(s)>
git commit -m "commit message"
where <file(s)>
is a list of files you want to stage and "commit message"
is a message describing the changes made in this commit.
Once a commit has been created, it becomes part of your project's history and can be used to revert or compare changes at a later time.
Git commits are snapshots of your project's code and metadata at a given time. They represent the changes you have made to your codebase, along with a message describing the changes. Commits are stored in a linear history, creating a timeline of your project's evolution.
To review pushed and unpushed Git commits in a specific branch, you can use the git log
command.
To view the list of all pushed commits in a specific branch, use the following command:
git log origin/<branch-name>
where <branch-name>
is the name of the branch you want to view.
To view the list of all unpushed commits in your current branch, use the following command:
git log origin/<branch-name>..HEAD
where <branch-name>
is the name of the branch you want to compare with your local branch, and HEAD
refers to your current branch.
This command shows the list of commits that exist in your local branch but have not yet been pushed to the remote repository.
how to see only that Git commits that are not pushed yet
You can view your unpushed Git commits using the following command in the command-line interface:
git log origin/<branch-name>..HEAD
where <branch-name>
is the name of the branch you want to compare with your local branch, and HEAD refers to your current branch.
This command shows the list of commits that exist in your local branch but have not yet been pushed to the remote repository.