Why .gitignore and .metadata are not getting commited?

Solution for Why .gitignore and .metadata are not getting commited?
is Given Below:

I am developing a flutter app, using bitbucket as the version control. Below is the .gitignore file:

# Miscellaneous

# IntelliJ related

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.

# Flutter/Dart/Pub related

# Web related

# Symbolication related

# Obfuscation related

# Android Studio will place build artifacts here

I do git add * and then git commit -m "message" to make the commit. How unfortunate , the .gitignore file never get commited.

When I am trying to do git pull or git pull --rebase, I get the below error

Updating 200df3e..02afe50
error: The following untracked working tree files would be overwritten by merge:
Please move or remove them before you merge.

Browsing the internet, the issue seems to be the .gitignore file and metadata not getting commited. So the pull can’t merge them.

How can I make sure these files are commited?


I followed user ti7’s answer, after the command git stash pop, I got the below message. what does that mean?

On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   ios/Flutter/Debug.xcconfig
        modified:   ios/Flutter/Release.xcconfig

Untracked files:
  (use "git add <file>..." to include in what will be committed)

no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/[email protected]{0} (799d2e53c1509af435d5d4d589a0ded18d3aad64)

The files probably don’t exist in your working tree, but do exist on the remote

  • add the files explicitly git add .gitignore .metadata
  • stash ’em git stash
  • then merge git pull
  • unstash git stash pop

The problem with git add * is that * is expanded by your shell, but not including .dotfiles