Repository Synchronization - GIT

Asked

Viewed 2,146 times

1

Well, I’m working on a project in college and I had some problems with using git when synchronizing a repository. More precisely, I received the following usage instructions:

  • The Master branch is the primary and should never receive an unnecessary/irresponsible/test push/pull request.
  • First of all, update the repository. Remember that your Fork is not automatically synchronized with the project.
  • Always update your repository before you start coding and always keep your code as up-to-date as possible to avoid conflicts.

I followed some tutorials on the synchronization internet as for example what the github itself makes available (for those interested: https://help.github.com/articles/syncing-a-fork/#Platform-linux), but almost all of them are in English, which makes my understanding difficult to some extent (even with the translations it gets a little difficult to understand ) and few really explain how I synchronize MY repository that was "forkado" with the MAIN repository of the project. Can someone help me or give me some way to go? It is worth mentioning that I use Linux. Thanks in advance. :)

  • To keep your project up to date, simply clone the git on your machine, it brings the current status of the updated project.... Every time you turn on your machine, and start changing the project, Sincronize, it pulls all the updates, branchs maids and commits performed by other persons in the repository. If you ever see for any reason that there are many different files on your desktop, files with changes that were not yours, just remove the folder from your machine, and clone the repository’s git again.

  • Just one more tip: The commands of git are the same both to linux, as for 'windows', I use the graphical version of windows and I’ve never had any problems, people who come from the universe Linux see more ease in working with the version Git shell, that is available in both environments as well.

  • So, we are working with different repositories, and I always have to synchronize MY repository with the MAIN repository from where I "forkei". In my opinion, deleting and cloning the repository ends up being seen as "gambiarra", since there are processes that have been created precisely to facilitate the solution of this problem. I just want to know what commands or procedures I should take to "optimize" my production.

  • fork in my understanding working with the tool, are precisely the branchs which differ from branch Master, after you do all the commits, and give a push or publish, Voce should give a merge in the branch so that your branch is included in branch master, if the owner of the repository, or yourself, disregards the branch, simply remove the same which does not affect at all the state of the branch master

  • The intention is not this, to keep deleting and cloning hausahsuh the ideal is just to give a sync that the project on your machine will be updated, as long as it is with an internet connection, it already downloads the files that do not have in your machine, this ruse to remove from the machine and clone again, it is only if you see that there is something wrong (Type 3 persons working on the same project, having an approval environment, a production environment, and the github for versioning control, sometimes if the team does not communicate, it may occur)

1 answer

5


I’m guessing you’ve already installed GIT on your local machine and already have an idea of how it works. If you have already done Fork, now you must clone the project to your machine. There is a green button in the upper right corner of the project that you click and it copies the link: inserir a descrição da imagem aqui

Then enter the directory where the project will be located, type the command: git clone followed by the link copied from the project: inserir a descrição da imagem aqui

Then enter the created directory (in the case of Spoon-Knife) and the operations are basically these:

To update your local repository:

  1. git fetch: recovers changes made to the remote server;

  2. git pull: downloads all remote changes to your local repository;

To upload your local changes to the remote repository:

  1. git add -A

  2. git commit -a -m "Descrição" -m "Detalhamento do commit"

All this information is here. Cool tutorial here.

  • Your answer helped me a lot...

  • Your answer helped me a lot... One question, what’s better, Fork or clone ?? In this case where the course provides a git for the material and this material can be changed, it would be better Fork or clone ?

  • 1

    @Fabioaragão, in very generic terms, the basic difference between fork and clone is that, in the fork, vc remains linked to the original content and can contribute to the code/development. When you do the clone, your copy of the code is independent of the original repository. If vc do not intend to contribute to the development, then prefer clone. Basically that’s it.

Browser other questions tagged

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