git/list[1] front-page[2] threads[3] people[4] search[5] about
 

How to update Git's metadata without affecting working dir?

From
RJRocky Ji <rockyji3438@gmail.com>
Date
May 17, 2019, 17:04 UTC
Message-ID
<CAN2Gq-Rb3v8-8PKmKUGKJ3wP-UvAF2n59a9UGbtjiGibE8q=zg@mail.gmail.com>

I am working individually at the moment. I have the habit of committing related changes on a regular basis, but I push to GitLab only at the end of class session.

-------Events to reproduce the situation--------
Thursday, in school:
- `git clone https://gitlab.../my-repo`
- create a few .rst documentation files
- commit the above changes before I `git push -U origin master`
Friday, in school:
- start working on new feature, create a test file `test_A.rb`
- I commit the changes but forget to push
Sunday, **in home**:
- I `git clone https://gitlab.../my-repo`
- work on the exciting new feature that popped in my head, create `feature.rb`
- commit the changes before I `git push -U origin master`
Monday, in school:
- running `git status` shows `Your branch is ahead of 'origin/master'
by 1 commit.`
--------end problem reproduction----------------
Questions I have
1. What will happen if I follow Git's recommendation `use "git push"
to publish your local commits`?
2. How do I resolve this situation? I don't want loose any information
i.e. preserve `test_A.rb` and `feature.rb` along with their commit
messages and timestamps.
3. Why does Git assume that local-working-dir is "ahead" without
consulting the Gitlab server first?
4. How to make Git "consult" (but not mess the working-dir) GitLab
repo before starting my day's work?
Thank you.
Next: Philip Oakley
Message 1 of 3 in “How to update Git's metadata without affecting working dir?”
  1. Rocky JiMay 17, 2019
  2. Philip OakleyMay 17, 2019
  3. Rocky JiMay 18, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.