0

I have the actual situation:

There is a project in which I have been working. It is git controlled. Another person copied the project but did not copy the .git folder and the .gitignore and .gitattributes files.

After that he made an interesting modification that I would like to integrate into the project.

My original question was going to be: How can I put all the original history to this last version of the project, but I think I have solved it, it is rather simple: I copied the .git and .gitignore .gitattribute files to the project and it immediately has the project git controlled (and of course I still need to commit the changes)

All nice and good except one thing that is bugging me. Now among the things I have to commit there is the "add .gitignore file".

Does that mean that this was lost from the previous commits???

KansaiRobot
  • 7,564
  • 11
  • 71
  • 150
  • I would like to ask you to elaborate the "add .ignore file" thing. What is it, exactly? – user3159253 Nov 16 '18 at 08:31
  • adding the .gitignore file to a commit – KansaiRobot Nov 16 '18 at 08:35
  • Likely you need to check your previous git state. I would suggest to use `git worktree` functionality (use a separate folder for the project with a chosen git state) or simply run `gitk --all` and view what files and with what content exist in the last committed version. Perhaps you never committed `.gitignore` file in that folder or something like that. – user3159253 Nov 16 '18 at 09:09
  • @KansaiRobot did my answer helped? – b-fg Nov 20 '18 at 08:26

1 Answers1

0

I would suggest to do a git add . then commit all changes as you would normally do. Then reapply your .gitignore as described in this answer to be on the safe side.

git add .
git commit -am "added new feature" 
git rm -r --cached .
git add .
git commit -am "fixed untracked files"

Make sure to commit your changes before doing the git rm -r --cached . or you will loose them.

b-fg
  • 3,959
  • 2
  • 28
  • 44