[git-users] How to move manually-versionned files to git (version control)?

2014-11-29 Thread Stavros Ioannidis
I would create the repository and add the oldest file as "myfile". Then i would 
repeat the following procedure for each file.
● copy and paste the contents of the next file into "myfile".
● commit with the right authoring date.

Maybe create a script to do this.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] How to move manually-versionned files to git (version control)?

2014-11-27 Thread Dale R. Worley
> From: John McKown 

> commit -m 'myfile as of '

The manual page for git-commit says:

   --date=
   Override the author date used in the commit.

DATE FORMATS
   The GIT_AUTHOR_DATE, GIT_COMMITTER_DATE environment variables and the
   --date option support the following date formats:

There seems to be an "author date" and a "commit date" in Git commits,
so it looks like you can set the "author date" to be the date the
original file was saved and still record the date you created the Git
commit as the "commit date".

Dale

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] How to move manually-versionned files to git (version control)?

2014-11-25 Thread John McKown
On Mon, Nov 24, 2014 at 6:55 AM, Konstantinos Mavroudakis <
kmavrouda...@gmail.com> wrote:

> I am preparing to move the source code for a project to git. There was no
> other version control in the past. I maintained old versions of file:
> "myfile" with change dates at the end as follows: myfile-d20130629,
> myfile-d20140223 myfile-d20141019 etc. "myfile" is the latest version.
>

​I have done something like this in the past. I did a "git init" to set up
git in the directory. I renamed "myfile" to "myfile-". ​Then
for each "myfile", in the proper order, I did "rename myfile- myfile"
followed by a "git add myfile && git commit -m 'myfile as of '. You might be able to "fake up" a script to do this sort of
thing for you. But you didn't indicate what OS you're running on, so I
don't know.

On Linux, using BASH as the shell, if __ALL__ of your files are
consistently named something like: -d., then a BASH
shell something like the following (not tested!) might work.

tar czf ../disaster.tar.gz . # just in case, in order to restore
set -e #abort if any command fails!
find . -type f |\
egrep '^.*-d[[:digit:]]{8}\..*$' |\
sed -r 's/^.*-d([[:digit:]]{8})\..*$/\1/' |\
sort -u |\
while read date; do
  find . -type f -name "*.-d${date}.*" | while read file;do
newfile=${file/-d${date}/};
mv -vn ${file} ${newfile} ;git add ${newfile}
  done
  git commit "files from ${date}"
done
set +e # restore normal processing

​In English the above does the following:
make a tar back just in case something horrible happens
"set -e" tells the shell to stop if any error occurs. I.e. do the least
amount of damage
find all the "regular" files in the directory and all subdirectories
select only files which have a name which "looks right" (egrep command)
use sed to extract the dates from the file names
feed that to sort to order them and remove duplicates
read each unique date
for each date, find all files with that date in the name. rename each file
to remove the date and add to the archive; for each date, do a single
commit with the date in the comment.

I hope this is of some help. I am fairly sure the above BASH script will
work, but no promises. Please be careful!!



> Is there a way (using git or other means) to integrate these old files to
> git under "myfile" name versioning preserving the individual old commits
> e.g (commit d20130629, commit d20140223 commit d20141019)?
>
> Moreover, is it possible to add the correct (past) date in each one of
> these commits?
>
> ​I don't know, but perhaps the --date= on the git commit will do what you
want.​


-- 
The temperature of the aqueous content of an unremittingly ogled
culinary vessel will not achieve 100 degrees on the Celsius scale.

Maranatha! <><
John McKown

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] How to move manually-versionned files to git (version control)?

2014-11-25 Thread Konstantinos Mavroudakis


I am preparing to move the source code for a project to git. There was no 
other version control in the past. I maintained old versions of file: 
"myfile" with change dates at the end as follows: myfile-d20130629, 
myfile-d20140223 myfile-d20141019 etc. "myfile" is the latest version.

Is there a way (using git or other means) to integrate these old files to 
git under "myfile" name versioning preserving the individual old commits 
e.g (commit d20130629, commit d20140223 commit d20141019)?

Moreover, is it possible to add the correct (past) date in each one of 
these commits?

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.