简体   繁体   中英

Update remote repository git

I am trying to pushed my code on gitlab existing repository I have pushed in it just few days before and noe I have modified some folders and files in my local repository and when I commit and push my code to my remote repo it is showing After commit -> NO changes added to commit and after push -> Everything is up to date

And when I look into remote repo , nothing is updates, it is showing my old code there.. I think this is because I update my local repository with some folders and files anyone here has an idea what could be the problem?

Maybe you need to remove git cache . Then pull remote/master . Then add/commit your local change. Now push to remote. Try following commands.

$ git rm --cached -r .

$ git commit -am 'message'     # add & commit your local changes
$ git pull origin master       # sync with remote/master
$ git push origin master       # push local/master changes to remote

I tried as per alert in git bash that git commmit -a -m "mymessage" then only the existing files got updated , not the new folder and files ..how can I update the new remaining folder??

From this comment I believe you are running git commit incorrectly... git commit -a does not commit untracked files. If you're creating new files, you need to explicitly add them using git add <file>

From the commit help pages:

-a, --all Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.

So I wanted to add some folders [and files in it] in existing remote repository SO I did simply to use git add path and after this git push --all

and done!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM