Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sync files without committing?

Tags:

git

I have a project I'm working on and have the following set up : one server with my git repos, one desktop pc and a laptop.

I work on my project sometimes on the desktop, sometimes on my laptop.

How can I sync my files between the desktop pc and the laptop without commiting changes to the server ?

like image 602
Running Turtle Avatar asked Feb 03 '11 11:02

Running Turtle


People also ask

How to sync files between computers without cloud?

Now let’s start to see how to sync files between computers without cloud. Solution 1. Share files over the network Solution 2. Easier way to keep files in sync between computers Solution 1. Share files over the network Windows offers a sharing feature that allows anyone in the same network to access the shared folders.

How do I sync files over the network?

Let’s see how to sync files over the network. Step 1: Find the file you want to share, then right-click the file and choose Properties. Step 2: Click the Sharing tab and then choose the Advanced Sharing... option. Step 3: Check the Share this folder and click Permissions to set the share permissions.

How to sync folders of the drive on another computer?

Tip: If want to sync folders of the drive on another computer, you can choose Remote to manage the computer and these computers must be on the same LAN. Go to the Sync page and click it in the toolbar. Specify the source and destination for files sync. Go to the Source section.

Is there a Free File Sync tool for Windows?

There is a free file sync tool for you. MiniTool ShadowMaker is a professional file sync software, which allows you to sync your files among multiple computers. In addition, MiniTool ShadowMaker also allows you to back up and restore files &folders and system you need.


2 Answers

You can more or less directly pull and push between your "clients", i.e. PC and laptop. The transport may be a direct connection like SSH or HTTP. But you can also use another repository on external media, that may be a USB stick, an external hard drive or even a service like Dropbox.

That way your workflow could look like this:

  1. Make changes on your laptop
  2. Commit your changes on your laptop
  3. Push commits to repository on a USB stick
  4. Pull commit from the USB stick to the repository on your PC
  5. Make more changes
  6. Commit them - you might also amend your other commit if you want your changes to be atomic
  7. Push your final commits to the repository on the server

Be aware that you'll always need to commit your changes locally before you can push them to another repository. It seems like you come from another SCM system like Subversion where committing always means "make the changes visible on the server and for everyone". Git works different, commits are only local before you push them.

like image 61
Koraktor Avatar answered Oct 28 '22 06:10

Koraktor


Just Use rsync command. Make sure you are in your local repo root path, and run: rsync -a --exclude=.git . [email protected]:[Your Remote Path]

you can fix your code in local, and rsync it. When the code can be deploy, then commit the deploy issue.

you can config your ssh remote alias in ~/.ssh/config file, google to know how to config it. Then your command will be: rsync -a --exclude=.git . [remote-alias-name]:[Your Remote Path] And needn't enter password.

like image 36
MistKafka Avatar answered Oct 28 '22 07:10

MistKafka