A
A
Akson872011-09-23 08:36:26
git
Akson87, 2011-09-23 08:36:26

How do you use GIT on multiple machines when working on the same piece of code?

I decided to keep up with fashion and try it out in a new GIT project. In general, I like everything, but there is one problem. More precisely, not a problem, but a misunderstanding of how to do it right.

I have 3 working computers (home, office, laptop) and I work on them in a rather chaotic manner, i.e. I can’t say that if I sat down at a working computer to write some kind of feature, then I wouldn’t have to finish it at home. In this regard, I want to understand how I should keep the code in sync across different machines. Now this case is a branch on the github, but it is visible to everyone and it looks somehow wrong, since the code there is usually unfinished. How do you synchronize code on different machines usually?

Thanks in advance for your replies!

Answer the question

In order to leave comments, you need to log in

7 answer(s)
D
Dmitry Shvalyov, 2011-09-23
@dshster

I create a bare repository in a folder synchronized via Dropbox, git push the project there, when I finish working on one computer, I synchronize Dropbox. On another computer, I sync Dropbox again and git pull the changes to the project folder on this computer. Something like this in general terms.
So far I have not noticed any shortcomings, except that I forget to start the project on one computer and edit on another. After that, you have to merge different changes.

P
philpirj, 2011-09-23
@philpirj

Create a branch for the "working" code, commit to this branch. When you feel that the code works, add it to master as well. It makes sense to add a branch for each new feature to make it easier to merge into the main branch.

K
Konstantin, 2011-09-23
@Norraxx

We all work on branches... There is a master, but each of the employees of the company works only in his own branch, and then everything is committed to the master by one person. For example, Linkus Torvald works in a similar way.

T
Troytft, 2011-09-23
@Troytft

We have 4 branches (2 developers), one per developer, develop branch and master branch. from which the changes go directly to the site.

U
un1t, 2011-09-23
@un1t

All right, this work should be done in branches.
We do so. A branch is created for a new feature, anyone can commit there, even not a worker. After the feature is debugged and tested, this functionality is merged into master or devel.

I
Ivan Klimchuk, 2011-09-23
@Alroniks

For my projects, I have a separate develop branch (there may be non-working code), as soon as the code has stabilized, everything flows into the master and is sometimes marked with the (version) tag. For bugs and features, if they are somewhere in the bugtracking system, then 2 options can be applied here. If the project is huge, then it makes sense to start a branch for a feature or a bug, if the project is small, then you can get by with prefixes to commits, and make branches for large features.

A
Akson87, 2011-09-23
@Akson87

Thank you all for the answers, it seems that I was not so far from the truth :)
Only it turns out that you either need to do many many remote branches, or all the code will accumulate in one heap and it turns out similar to SVN. But in any case, you can work :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question