0

I'm currently working on a branch made from develop branch, but theres a team that was working and commiting their work to master branch, so I added and commited all my stuff to my working branch. I decided to merge master into develop, so I changed to develop made a pull, changed to master and made a pull... but if I do a git status it shows untracked files, if I switch back to develop and do git status the untracked files are gone, what am I missing?

EDIT: adding more info the repo is divided into two directories, one for frontend (I'm doing the source for frontend) and one directory for the backend code (the other team is working in this code). For some reason they started to work directly with master branch instead of develop, while I was pushing to develop. That why I needed to merge master into develop, so they can start working from develop and not master.

finished working on my feature-branch did:

- git add .
- git commit -m "commit message"

- git checkout develop
- git pull
(git says nothing to update)

- git checkout master
- git pull
(git says Fast-forward - 31 files changed, 1003 insertions(+), 63 deletions(-))
- git status
(git shows untracked directory)

- git checkout develop
- git status
(git doesn't show untracked directory)

UPDATE: having checked out master, did:

 - git add .

(git started adding directories it shouldn't, like for example node_modules inside the frontend directory)

Could it be some sort of .gitignore missconfiguration?

matt
  • 515,959
  • 87
  • 875
  • 1,141
Dieguinho
  • 758
  • 2
  • 14
  • 31
  • Did the pull on master fail? What did git reply after the pull? – matt Mar 20 '20 at 18:32
  • What do you mean by "made a pull"? Quote (as in cut-and-paste the text from) the actual commands you ran and their output, if possible. – torek Mar 20 '20 at 19:08
  • @matt no problem at all - Fast-forward - 31 files changed, 1003 insertions(+), 63 deletions(-) – Dieguinho Mar 20 '20 at 19:27
  • @torek sure: 'git checkout master' then 'git pull' – Dieguinho Mar 20 '20 at 19:27
  • Where did the untracked files come from? Are they stuff you just pulled or did you add them to the working folder? – matt Mar 20 '20 at 19:36
  • So you ran: `git checkout master; git pull` and got `Fast-forward - 31 files changed, 1003 insertions(+), 63 deletions(-)` and then you ran `git checkout develop; git pull` and got the exact same message? (You said you ran `git pull` *twice*, but in your reply to @matt you show *one* output.) You obviously also ran some `git status` commands. Since `git pull` modifies your work-tree, it would help a lot to have a complete picture of where each command went in the sequence, where the `git status`-es were, and so on. – torek Mar 20 '20 at 19:47
  • @matt I'm guessing from the develop branch structure, I can't see the files but the directory, added some info explaining the situation to help clarify – Dieguinho Mar 20 '20 at 20:00
  • @torek sorry, added more info to try and clarify the issue and the steps I made – Dieguinho Mar 20 '20 at 20:00
  • Just to clarify, when you say “finished working on my feature-branch”, does that mean there are actually _three_ branches in this story? – matt Mar 20 '20 at 20:09
  • Also, I’ve never heard of “I can't see the files but the directory“ and there is no such thing as an untracked directory, git does not track directories and would not add one in and of itself. – matt Mar 20 '20 at 20:11
  • @matt thanks for the edit. Yes, I work branching from develop, when I finish I merge into develop, but the problem is between develop and master I guess. When executing git status on master I get: "Untracked files: (use "git add ..." to include in what will be committed) ./ " but when executin git add . thats when it shows me all the files that were untracked inside the ./ dir don't know if I'm making myself clear =/ – Dieguinho Mar 20 '20 at 20:29
  • Is there some sort of checkout hook on the server so that the gitignore differs per branch? – matt Mar 20 '20 at 20:45
  • @matt not that I know of. First project that happens this stuff – Dieguinho Mar 20 '20 at 20:46
  • My best guess here is there are different rules in `.gitignore` between the `master` and `develop` branch. You can compare them with the command `git diff master develop -- .gitignore`. What does this diff show? – Code-Apprentice Mar 20 '20 at 21:54
  • 1
    Possible explanation: the directory is in `.gitignore` on `develop`, but some (not all) of its contents were added and committed. The files that weren't committed don't show as untracked on `develop` because they are ignored. When you check out master, the files that are committed on `develop` are deleted but the ones that are not committed are not deleted. This will show the directory as untracked when you do `git status`. – Code-Apprentice Mar 20 '20 at 21:57

0 Answers0