0

i have a codeigniter project in ubuntu server

i normally upload files to bitbucket. and in ubuntu server i pull the files from bit bucket

but in project, users uploads images in frontend of the website.

And when i pull, git says local contain changes that are not in remote and aborting the pull

so i typed

git add .
git commit -m "message"
git pull

is this the right way to do this?

Do i need to exclude the uploads folder from git..

folder structure

var/ww/html

application
uploads
.git
nithin k
  • 45
  • 1
  • 6
  • Does this answer your question? [How do I ignore an error on 'git pull' about my local changes would be overwritten by merge?](https://stackoverflow.com/questions/14318234/how-do-i-ignore-an-error-on-git-pull-about-my-local-changes-would-be-overwritt) – phd Feb 15 '20 at 10:12
  • https://stackoverflow.com/search?q=%5Bgit%5D+Your+local+changes+to+the+following+files+would+be+overwritten+by+merge – phd Feb 15 '20 at 10:12

1 Answers1

0

Typically user uploads should not be considered part of your code repository. You can tell git to ignore that folder by opening .gitignore and adding the line uploads/*

The error you are getting is indicating, however, that your local branch has updates that your remote does not (meaning it is ahead). Assuming no other developers (or users) are editing your remote branch, you can get by this by calling git pull before you make your changes, and then add, commit and push your changes to the remote.

If you have already made changes and then your remote changes, you can get around this by calling git stash to store your changes elsewhere and then git stash apply to bring them back after you have pulled the changes to the remote branch.

If you are working on a project with other developers, you may want to read up on proper team git workflows, particularly how to use feature branches and pull requests.

C-RAD
  • 1,052
  • 9
  • 18