Search code examples
gitgithubgit-push

Github push commit issue


How to push folders contain of files without remove old commits in github?

I already upload some files to git But next i upload another file.old ones are deleted


Solution

  • When you want to try to update your repo by doing a push you shouldn't run git remote add origin 'url_name' in fact trying to run this command gets me this error:

    *:\***> git remote add origin 'url.git'
    error: remote origin already exists.
    

    git remote add origin 'url_name' adds a remote to a Git repository that's why it's deleting your "old" files.

    For updating your repo and keep your "old" files use this commands:

    git status
    git add . 
    git commit -m "update"
    git push origin branch_name
    

    In your case branch_name is master. Let me know if it worked for you and if it did accept the answer :)