This question has been flagged
1 Reply
4198 Views

example

~$: ls -l /opt/odoo/odoo-server/addons | grep account

returns a date Sep 23 11:43 for the module 'accountant'

the folder account in https://github.com/OCA/OCB/tree/8.0/addons says 'a day ago' (which is Sep 26)

is 'git status' not the correct command to show whether there are any updates in your remote origin (do to the manpage I would say it is)? what would it be instead?

I had the same situation before  I actually updated from the v8 RC Version to v8 stable with a git pull origin 8.0 and there was something to pull, so the ooutput of git status was misleading.

Avatar
Discard
Best Answer

git status is a command to show summary / information about your local git repo. git is really a distributed version control system. It means that you control your local git repo for most of the time. git doesn't provide a command to check status of remote repo. To download all new remote commits, if available, you can use git fetch. In fact, git pull, is a shortcut for git fetch, then git merge. The workflow would be something like the following.

  1. git fetch --progress
  2. notice a new commit
  3. I'm in 8.0 branch. I want to merge just the 8.0 branch.
  4. git merge origin/8.0

[1] https://www.kernel.org/pub/software/scm/git/docs/git-fetch.html

[2] https://www.kernel.org/pub/software/scm/git/docs/git-merge.html

 

Avatar
Discard
Author

I though 'git status' was there to show difference between local repo and it's origin. I wanted to use it to see whether there IS anything to pull. Till now I am updating my local repo with 'git pull origin 8.0' which (as you also say) combines 'git fetch' and 'git merge' in one command. If I understand you correctly 'git status' does not compare my local with it's remote origin but just only returns info about my local repo (like whether I have changes made, i.e.), right?

Yes. What I mean local repo is "working tree". Check also https://www.kernel.org/pub/software/scm/git/docs/git-status.html

Author

I think I got the fetch, merge, pull magic now: fetch = download a new commit (without doing anything with it yet) merge = 'applying' the downloaded files (merging them with your local repo) pull = fetch & merge in one step

Author

what is the advantage of doing 2-steps (git fetch, git merge)? A disadvantage might be that you download (fetch) data for all branches (7.0 & 8.0) even if you only need 8.0 (as in my case). I don't even have a clone of 7.0 even but apparently git fetch doesn't mind. So, for now I would be in favor of a git pull origin/8.0 (being said that I am a passive git user. I don't code anything, I only update my local installation from the remote origin)