Skip to content

Instantly share code, notes, and snippets.

@nishitpatel
Created April 10, 2017 13:37
Show Gist options
  • Save nishitpatel/1b3ea87a1b30938dbd370c2ac914ec73 to your computer and use it in GitHub Desktop.
Save nishitpatel/1b3ea87a1b30938dbd370c2ac914ec73 to your computer and use it in GitHub Desktop.
Add GitIgnore to existing Repository.
Step 1: Mannually add git ignore file on git server with predefine templates for ex. if you are adding gitignore file in
iOS project than user Object-C template.
Step 2: After successfully adding git ignore update your local branch code with latest code.
Step 3: While Merging master code with local code may be you will see VIM editor to add commit message. So for VIM editor
Just press ESC -> : -> x it will close VIM editor. After than perform
Git add .
Git commit -m "COMMIT MESSAGE"
Git Push origin "BRANCH_NAME"
Step 4: After you run your project you will still see the untracked files. To remove those files perform following setps.
May be in your repository you will see any other file so below path is just for reference please don't take it seriousally
other wise you will be in trouble.
i: git rm --cached ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState.xcuserstate
ii: git commit -m "Removed file that shouldn't be tracked"
Step 5: After performing above steps again add, commit and push to server branch.
Step 6: FINISH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment