MiniMe
MiniMe

Reputation: 1275

Working with GIT4Windows, shared folder and two computers-is this workflow correct?

I have two computers, my laptop and my desktop, both running Win10. I want to use git to keep in sync the Python sources of a app I am working on. I am the only developer so mainly git is used here to sync the files and to control the versions

My work flow at functional level will be like this:
❶ Create a main repo on the desktop
❷ Start the development work and write some code
❸ Share the folder
❹ Clone it to the laptop
❺ Continue to work at a remote location for a while
❻ When I get back home I push the changes to the desktop repo
❼ The next step in unclear for me I need to read how to integrate the changes (I am new to git)
❽Now that the changes are integrated I continue the work on my desktop When I need to go to work at a remote location I fetch the recent changes on the laptop and I loop back to ❺

Is this going to work? Is there a better way to do it ?

Would it be a better approach to work with a repo hosted on the desktop and then clone that to the desktop and to the laptop with each one pushing their changed to the repo on the desktop?

Edit: I am reading more about git while waiting for suggestions here. Here is an update of my understanding:
-create a bare repo on the desktop
-create a repo on the desktop
-work and push your updates to the bare repo
-clone the bare repo to the laptop
-work and push your upates to the bare repo

Not sure how I sync the bare with the repo on the desktop now ? git fetch?

Upvotes: 1

Views: 130

Answers (2)

MiniMe
MiniMe

Reputation: 1275

This worked:
the code is currently on the laptop
1) create a shared folder on the Desktop.
2) run git init -bare there
3) run git init in the folder that contained the code on the laptop
then git push -u dektop master (where "desktop" was a remote previously defined , use file://a:\Dektop, a is the mapped drive that folder. Using an UNC is fine; make sure you have RW rights for that shared folder)
4) create another working folder on the desktop and you run git init there 5) clone the repository created in the git init -bare folder

now each computer (laptop and desktop) must push code when the work on it was finished and it must pull code when the work begins. These will keep everybody in sync

Upvotes: 1

Romain Valeri
Romain Valeri

Reputation: 21938

(web-base alternative)

Of course you can set a workflow between two repos, or even have a third one on your desktop, as you described, but another solution would be to use one of the very reliable web-based hosting services offering git repository creation and management.

Some advantages over an in-house solution :

  • safe from crashes,
  • can be shared with anyone else without security concerns about your own machines,
  • and a lot of added features typically proposed by these platforms, like pull requests if you want to use them, pipelines, and so on.

I won't argue here in favor of any, most of them have some form of free service as a starting point and propose more features for professionals.

Let's just name among the most obvious ones, GitHub, Bitbucket, Gitlab...

This could act as an central repo for your syncing needs between your machines.

Upvotes: 1

Related Questions