Ron van der Heijden
Ron van der Heijden

Reputation: 15070

GIT clone changes to Windows directory

When I use git status I have the following lines:

modified:   system/controllers/accounts.php
modified:   system/models/account.php

How can I copy these changes to a windows directory without changing the git status?

So my windows tree would be:

Upvotes: 0

Views: 47

Answers (2)

Ron van der Heijden
Ron van der Heijden

Reputation: 15070

The solution I came up with (with the help of Stony) and this source:

#!/bin/bash

clear

# Navigate to the directory
cd .
cd D://NetBeansProjects/project/

# Check status, what files are changed?
git status

# Ask for commit message
read -p "Commit message: " message

# Add the changes to the head
git add .

# Commit the changes
git commit -m "$message"

# Archive the last changed files
git archive -o ~/Desktop/update.zip HEAD $(git diff --name-only HEAD^)

# Pause the terminal so I have time to read
$SHELL

This does change the status, but that is the GIT way I suppose.

Upvotes: 0

René Höhle
René Höhle

Reputation: 27295

You are in the context where the files are modified. So you can go to that directory and copy that files to another location or you use the command line and copy them.

So if you copy them in that branch you don't modify them.

To copy all modified files (if you have a lot of files) then you can try the following line.

cp -R $(git ls-files --modified) ../modified-foder-for-files

Upvotes: 1

Related Questions