Pointing directories in git

Asked

Viewed 173 times

0

I’m now starting to use the git service, more precisely Github, but I have some questions:

My Javascript projects are all in a directory on my Desktop, but all the git tutorials I’ve read say to create and set up a local folder where the files will be commit data, I’ve created a folder in my documents, but every time I change the files in my project folder, I copy the files to the folder I created for git and through Gitbash upload the files?

This is still a little confusing for me, after all, now I must centralize all my codes in all languages in this single directory? How does this git folder where the INDEX is, etc?

  • Think of a git repository as a workbook "smart", that is able to track and translate all the changes you make in your project. So for each project you should have a separate repository, and the work is done within it, you don’t have to copy from one side to the other. Github is basically an online service to save and centralize your folder.

2 answers

1

Friend is not quite as you think, first you will create a repository on Github and then clone on your machine. After that you will copy all your files that were in another folder into your repository folder, done this you will no longer work in your old folder but inside the Github repository folder where all the changes you make can be committed and uploaded to Github there.

I hope I helped friend.

0

I advise you to create a workbook for each project. After that, use the following command in the chosen folder. This command initializes a new local repository.

git init

Since you already have a local repository, run the following command inside your workbook.

git remote add origin git://github.com/usuario/meurepositorio.git

The above command links a remote Github repository to your location (workbook).

After you commit, you can upload the changes to your Github repository using the command:

git push origin master

Browser other questions tagged

You are not signed in. Login or sign up in order to post.