Pro-Tip: ReSync Your GitHub Repo

By Xandermar LLC, February 16, 2024

Let's say you've been working on a repository but a co-worker has informed you that you need to keep certain files and folders from the repo. For example, you're working on a Drupal 10 environment and notice you've been pushing the docroot/core, docroot/modules/contrib, and docroot/themes/contrib directories. Here's how to update the repo with a new .gitignore file.

Create or edit .gitignore file

Create the new .gitignore file (or edit the existing file) at your project root. Be sure to add all the files you'd like to remove or not exist in the repo. 

Remove all git cached files

git rm -r --cached

Re-add all files as mentioned in the new .gitignore file

git add .

Commit the new .gitignore file to apply the repo change

git commit -m ".gitignore updated"

Finally, just push the code to update the repo

git push

Hope this helps you! Let me know in the comments if you know a better way! 

Tags

New Articles Alert

Associated Tags

Comments