Git is a free and open-source distributed version control system.
In this shot, we'll learn how to view git commits that have not been pushed to the remote repository.
We can view the unpushed git commits using the git
command. It will display all the commits that are made locally but not pushed to the remote git repository.
git log origin/master..HEAD
Let's take a look at an example.
Below are the commands we will be using:
# create a file and write content with the tee commandecho "This is a test file" | tee test.txt# add all files in current folder to git staging areagit add .# commit all changesgit commit -m "Added test file"# view unpushed git commitsgit log origin/master..HEAD
Execute the given commands sequentially in the terminal below:
test.txt
to a test repository.git add .
to stage the newly created file for the next commit.git commit
but did not push them to the remote repository.git log origin/master..HEAD
.We can view the unpushed commits in the final output of the terminal.