Configure git for an existing project folder

1

I have a project already under way where we are adopting scrum as a development methodology.

Git is already configured to commit and the clone is working perfectly.

My question is, do you have to make the git clone into an existing folder with project files or does a new folder have to be created? Because when I point to an existing folder it does not allow.

    
asked by anonymous 05.02.2018 / 18:21

3 answers

4

You can not clone a Git repository to a folder that is not empty, this is not allowed.

If you've already done some development outside the repository, do the following:

  • Clone the repository
  • Create a new brach
  • Play the code over this branch, if it is in the same structure, otherwise you will need to copy over it individually
  • Resolve conflicts
  • Commit commit
  • Make merge of the branch
  • 06.02.2018 / 14:37
    2

    Alternatively, you can start a repository locally with git init .

    After doing this, I recommend that you do commits locally, even to avoid losing work if gives you a problem or you inadvertently run some command with occasional side effects in the data.

    Ready, after doing your commits, let's add the remote GitHub repository. You can follow the own GitHub tutorial , or decorate some commands (explanation below the command: / p>

    git remote add origin [email protected]:user/projeto-muito-legal-show.git
    #              \___/   \____________________________________________/
    #                |            endereço remoto do projeto no github
    #         apelido do repositório remoto
    
    git fetch origin
    

    Okay, now you have a remote configured correctly. After that, we can mix your branch with the branch remote (if something already has been created). Or, if the repository is still empty, just push.

    To mix, you usually use% ( documentation ) to mix with the branch git merge origin/master of the GitHub repository. But you can also try rewriting the history by putting all commits that you made as commits children of the remote branch , using master (documentation ).

    git merge origin/master    # para fazer o merge
    git rebase origin/master   # para fazer o rebase
    

    In the third case, you still have nothing on the remote. So you just need to give%% ( see more on this question , see documentation ).

        
    06.02.2018 / 15:04
    -2

    If you already have a repository created and a local project and you want to upload the changes to your repository and just use the command git remote add orig

    git remote add origin "repository location" git push -u origin master

    ex: git remote add origin link      git push -u origin master

        
    09.01.2019 / 19:31