0

I don't know exactly how to put it but here is my problem: I have a git repository related to laravel project. I also have the same folder on local but i deleted the .git folder, .gitignore and .gitattrib files, i.e. my local folder is no longer connected to github. Now i have made changes to local files and want to push those to the original repository. How can i do that?

  • 1
    How many files have you changed? The quick and dirty approach might be to clone that repository again, and then overwrite the files you've modified with your versions. – Tim Biegeleisen Apr 21 '17 at 04:25
  • You can see [this answer](http://stackoverflow.com/a/6246975/5085788), specifically the part of **uncommited changes**. – luisenrike Apr 21 '17 at 04:31

1 Answers1

0

One way to do this would be to simply commit your changes as a new commit in your repository:

  1. Ensure you have a clone of your repository locally

    If needs be, reclone it, or if you already have one you can most likely reuse that clone.

  2. Make sure you're on the right branch in that clone

    If needs be, create and checkout a new branch for the modifications that you did locally while "unconnected to GitHub".

  3. Then bring those changes into your working folder of the clone

    Basically, copy from the local, "unconnected" folder
    ... and copy to the working folder of your repository

    Note! If any of your "local changes" involved deleting or moving file you need to ensure you do the same thing in your working folder.

    If you got any kind of directory comparison tool, such as Beyond Compare, then you should use this to ensure you synchronize not just file contents but also directory structure.

  4. Then all you have to do is commit your modified files into your repository
    1. Do a git status to ensure everything looks good
    2. Do a git status --ignored to ensure git won't ignore any files you care about
    3. Do a git add . to stage your modifications
    4. Do a git commit to commit your changes
  5. Verify everything looks good

    Do a build, whatever

  6. Merge your changes into your main branch (develop or master or whatever)
Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825