How to add git repo to the project working directory

I have a git repository in BitBucket with a big project. I also have the same project locally on my computer in a directory that is not under git. In my local directory there are many modifications that are not in the repo that I want to commit.

So, how do I synchronize the local directory with the git repository so that I can make my changes and continue from now on. It’s normal that the changes go to the master, I’m looking for the simplest possible solution.

Edit: to find out, I was working on SVN, had some uncommitted changes when I finally decided to switch to git. So I imported the SVN history into git using git-svn and then disconnected the local project from SVN.

+4
source share
1 answer

Set up the Git repository in the working directory:

 git init 

Commit everything you have:

 git add . git commit 

( git add . assumes that you do not have files that can be ignored, perhaps do this for each file or copy through .gitignore .)

Now add the Bitbucket repository as remote:

  git remote add origin <url> 

Pull and rebase with Bitbucket:

 git pull --rebase origin master 

And when you are satisfied with the results, click them:

 git push -u origin master 
+5
source

Source: https://habr.com/ru/post/1486806/


All Articles