SQL Practice Blog – SQL Server, BizTalk und .NET Erfahrungen

Archive for the ‘Git’ Category

Git: Add .gitignore after commit

leave a comment »

I had created a new repository in GitHub and forgot to add the .gitignore file to ignore all my Visual Studio and debugging files. However, I did not realize it until after I created the first commit.

These are the steps to apply the gitignore file later:

  1. Create a .gitignore file in the root of your local repository.
  2. Run this command. This removes everything from the index:
    git rm -r --cached .
  3. Re-add all files. Now the files and folders from gitignore are ignored.
    git add .
  4. Then commit the changes again and push it to your GitHub repository
    git commit -m ".gitignore is now working" 
    git push
Advertisements

Written by Robert Meyer

Oktober 4, 2017 at 07:21

Veröffentlicht in Git

Tagged with , ,