.gitignored some files only recently; trying to merge into a previous branch, ignored files show up as conflicts

I had a branch devel from which I branched out A topic branch in the past.

devel was always intended to be the parent of A (everything devel had/hadn’t should reflect in A). After a long time, I’ve added some files to .gitignore and updated the index of devel to reflect it.

  • Keeping a branch up to date with master
  • Should I use git to deploy websites?
  • Running a compiled Jar file in Jenkins
  • Versioning using GIT revision
  • git reconnect to a remote repository
  • What does UserA committed with UserB 13 days ago on github mean?
  • Now I’m trying to merge devel back into A again.. to reflect those changes (.gitignoreed files from it) but it gives me a merge conflict in those ignored files. I don’t want those ignored files in A. How do I tell that to git?

    screenshot if it helps…
    enter image description here

  • Resolving same conflicts again and again when doing rebasing more times
  • Overriding “@package_version@” in PHPUnit output when installing from Git repo
  • Git with development and production environment
  • Undoing a git pull --rebase
  • Android Studio and Github missing .iml files
  • Setting up a git remote origin
  • One Solution collect form web for “.gitignored some files only recently; trying to merge into a previous branch, ignored files show up as conflicts”

    I would rather, before merging devel to A, making sure all devel ignored files are ignored as well in A.

    The trick for that is to remove from the index of A everything, update the .gitignore content, and add everything back!

    git checkout A
    # update the .gitignore file from devel in A
    git checkout devel -- .gitignore
    
    # remove/add everything
    git rm --cached -r .
    git add .
    git commit -m "new commit with devel gitignore files out" 
    
    # then
    git merge devel
    
    Git Baby is a git and github fan, let's start git clone.