How to add git repo to working dir of a project

I have a git repo in BitBucket, with a big project. I also have the same project locally on my computer in a dir, that is not under git. In my local dir, there are quite a few modifications that are not present in the repo, which I want to commit.

So, how do I sync the local dir, with the git repo, to be able to commit my changes and continue from there on. It’s ok the changes to go in the master, I’m looking for the simplest possible solution.

  • Git repo won't get garbage collected after reset --hard
  • Unintended merges on bitbucket
  • How can a user with read-only access to Git make a pull request?
  • Probably a Stupid Issue with Git
  • BitBucket: how to track a repo's branches in its Wiki repo?
  • how to copy and replace some project files in a branch only in git
  • Edit: For clarification, I’ve been working on SVN, had some uncommitted changes when I finally decided to switch to GIT. So I imported the SVN history to GIT using git-svn, then disconnected the local project from SVN.

  • How to pull into all branches?
  • Git - how to merge additional branch changes after branch has been 'merge --squash'ed
  • Authentication for Git Daemon and Windows
  • Maven Build Number Plugin version not filtered
  • Is it better to keep Git repository inside or outside of Eclipse workspace?
  • Cordova: Exclude plugins and platforms
  • One Solution collect form web for “How to add git repo to working dir of a project”

    Set up a Git repo in the working directory:

    git init
    

    Commit whatever you have:

    git add .
    git commit
    

    (The git add . assumes you have no files to ignore; maybe do this per file or copy over the .gitignore.)

    Now, add the Bitbucket repo as a remote:

     git remote add origin <url>
    

    Pull and rebase from Bitbucket:

    git pull --rebase origin master
    

    And when you’re satisfied with the results, push them:

    git push -u origin master
    
    Git Baby is a git and github fan, let's start git clone.