I have a problem with Git ignoring automatic changes my server does in the local repo. I have a generator, which generates a code and stores it in a folder called "generated/". I am using NodeJS for this and the procedure of writing files is done by:
fs.WriteFileSync();
According to the documentation this function:
synchronously writes data to a file, replacing the file if it already exists. data can be a string or a buffer.
The "generated/" folder has a git repo inside and at the end of each code generation it automatically calls:
git add -A
git commit -m "message"
git push
This is suppose to push the generated code to a remote repository. But it does not. It is always one generation behind for some reason. If I generate a code in generation #1 and push it, no changes are pushed to the repo. If I generate again in generation #2, the changes from generation #1 are pushed to the repo. It is always one generation behind.
My guess is that it is because the function I use replaces the files and Git does not know about it at first to only the old changes are pushed. Once I call another generation, Git finally knows that there are some changes done in the first code generation and pushes that one.
I hope my description is proper. Does anyone knows how to fix it? I think I need to let Git know that the files were replaced but I do not know how.
Any help please? Thank you!
you could find all the untracked files and add them,
for i in `git ls-files --others --exclude-standard`
do
git add $i
done
or just the changed files
for i in `git diff --name-only`
do
git add $i
done
the continue with your commit and push.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.