Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Devops
  3. Question
Devops

git - Your branch is ahead of 'origin/master' by 1 commit

Asked by Ava Black Jun 8, 2021 12.1K views 2 answers
Share

About this question

I am new to git and working on it.

I added some files in git :

git add 
git add

then I wanted to push that for review, but mistakenly I did

git commit

so the files which I have changed don't go for reviews.

Now if I enter the command :

git status

Getting massage:

# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)

I want to revert that commit and I want to push those files for review rather than commit. Can anyone let me know how I can do that?

Your answer

2 Answers

Ranjana Admin JanBask Expert Latest answer

Answered on Apr 26, 2024

This message indicates that your local branch has one commit that hasn't been pushed to the remote repository's master branch (origin/master). To sync your changes with the remote repository, you can simply push your local commits to the remote master branch.


Here's how you can do it using Git:

  git push origin master

This command pushes your local commits from the master branch to the remote repository (origin) and updates the origin/master reference to match your local master branch.

After executing the push command, you should see a message indicating that the push was successful, and your local and remote branches should be in sync.

If you encounter any errors during the push, such as conflicts or authentication issues, you may need to resolve them before successfully pushing your changes.


Was this helpful?

More Devops discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest DevOps Blogs

Guides, tips and career advice on DevOps from JanBask experts.