Git (Was: can't get includes to load) [message #180942 is a reply to message #180941] |
Thu, 28 March 2013 07:35 |
J.O. Aho
Messages: 194 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 28/03/13 08:17, Cal Dershowitz wrote:
> On 03/27/2013 03:00 AM, J.O. Aho wrote:
>
>> first of all, I would remove all the files ending with ~
>>
>> find /home/sites/migrate -name "*~" -exec rm -f {} \;
>>
>> just copy paste that one, if you feel insure, then make a backup of the
>> directory:
>>
>> cd /home/sites/ && tar -cf ~/migrate.tar migrate && cd && gzip
>> migrate.tar
>>
>> (I know, you can simplify that)
>>
>> Keep in mind, both are "one liners" and just copy past from this post.
>
> Alright, good things, JO, the commands seemed to work just fine. What's
> more, you wrote these commands at a level where I have the vaguest
> notion of how they work, which is also important.
The first one uses find to find files, in this case the files ending
with a tilde and then delete those, the {} is the file name and the \;
is just telling we are at the end of the command we wanted to run on all
the found files. Keep in mind to always have the "" around the file name
you are looking for, or bash will expand it and you will get false results.
> $ cd /home/sites && git init && git commit -m "initial commit" -a
> Initialized empty Git repository in /home/sites/.git/
> # On branch master
> #
> # Initial commit
> #
> # Untracked files:
> # (use "git add <file>..." to include in what will be committed)
> #
> # .jonathan.txt.swp
> # j2.txt
> # jonathan.txt
> # migrate/
> # www.nmlutherhaven.com/
> # www.sttimschurch.net/
> nothing added to commit but untracked files present (use "git add" to
> track)
Sorry, the -a option don't work with uncommited files, it to work the
files has to be in the repository already.
> Now did it take a snapshot all the way up the directory tree?
No, there is nothing in the git repository at the moment.
> The directories there with url-sounding names were the results of wget
> commands. I don't need them anymore. How would I go about deleting
> them and them bringing them back to life with git just for practice?
As your commit failed, you need to first add files
git add migrate j2.txt jonathan.txt && git commit -m "initial commit" -a
and now you would have the migrate and the two text files in the repository.
There is two ways to remove something from the repository, method one:
1. Delete/Rename/Move the file you want to remove
2. git rm <file>
3. git commit -m "why you remove it" <file>
or shorter (this will delete the file for you):
1. git rm <file>
2. git commit -m "why you remove it" <file>
<file> = file or directory
|
|
|