Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Status does not show 'ahead of' after edit and commit to local repo

Tags:

git-status

Our company's workflow is to clone master branch into a _Test branch as we work on new features and we continually push/share this _Test branch until a set of features are complete and approved by client, then we merge to master branch and build and publish our sites. Then rinse and repeat.

The problem I'm having is git status isn't showing the correct ahead/behind (or more likely, I may not understand what it is supposed to show) while working on the _Test branch. If I do the following steps:

  1. git checkout _Test
  2. git pull --rebase origin _Test # get latest code
  3. edit some files
  4. get commit -am "Test commit"
  5. git status

After step four, the git output is

[_Test d6fa824] Test commit
1 file changed, 1 insertion(+), 1 deletion(-)

Then after step five, the git output is

# On branch _Test
nothing to commit, working directory clean

Shouldn't it say?

Your branch is ahead of 'origin/_Test' by 1 commit.

If I look at qgit or gitk they show origin/_Test and remotes/origin/_Test respectively (correctly) 1 commit behind the last test commit. I'm running msysgit and git version outputs:

git version 1.8.1.mysysgit.1

So I'm confused why the output from git commit doesn't state that I'm ahead of origin/_Test (when obviously I am since I just committed) and why git status doesn't state same information.

Let me know if I need to provide any more info.

like image 831
Terry Avatar asked Jun 17 '13 17:06

Terry


People also ask

Why does git status says up to date but not?

On branch master, Your branch is up to date with 'origin/master. As long as you haven't made any new commits that message is correct, unversioned/changed files that haven't been committed yet should be listed below it. If unversioned files don't show up, check if they might be hidden by a .

How do I see locally committed changes?

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.

What is the command to get the current status of the git repository?

The git log command is Git's basic tool for exploring a repository's history. It's what you use when you need to find a specific version of a project or figure out what changes will be introduced by merging in a feature branch.

How do you check the state of your local git repository since your last commit?

Use the git status command, to check the current state of the repository.


1 Answers

I resolved this problem.

You basically need to set up git tracking using

git branch --set-upstream *branch_name*

Read my full explanation here

like image 83
gray Avatar answered Sep 29 '22 07:09

gray