You have deleted the file HelloWorld.java but not yet committed, if you want to restore it :
git checkout HEAD HelloWorld.java
venerdì 26 agosto 2011
giovedì 25 agosto 2011
Git, undoing uncommitted changes
You have the staged file HelloWorld.java, you have modified it and staged those changes but then you want to unstage those changes :
git reset HEAD -- HelloWorld.java
You have a new file HelloWorld.java, you have added it to staged files but then you do not want to commit the new file:
git rm --cached HelloWorld.java
if you want to undo all changes:
git checkout
Be careful, git checkout removes all untracked changes and you can't recover those changes anymore (files never tracked by Git will be deleted).
git reset HEAD -- HelloWorld.java
You have a new file HelloWorld.java, you have added it to staged files but then you do not want to commit the new file:
git rm --cached HelloWorld.java
if you want to undo all changes:
git checkout
Be careful, git checkout removes all untracked changes and you can't recover those changes anymore (files never tracked by Git will be deleted).
mercoledì 17 agosto 2011
My personal imaginary interview with The Clean Coder book :-P
Me : I must know my code works but how can I know my code works?
Uncle Bob's book : That's easy. Test it. Test it again. Test it up. Test it down. Test it seven ways to Sunday!... and don't forget to automate your test.
Me: But isn't code hard to test, my code really is?
Uncle Bob's book: yes but only because that code has been designed to be hard to test.
Me: how can my code be designed to be easy to test?
Uncle Bob's book: the best way is to write your tests first, before you write the code that passes them (TDD).
Uncle Bob's book : That's easy. Test it. Test it again. Test it up. Test it down. Test it seven ways to Sunday!... and don't forget to automate your test.
Me: But isn't code hard to test, my code really is?
Uncle Bob's book: yes but only because that code has been designed to be hard to test.
Me: how can my code be designed to be easy to test?
Uncle Bob's book: the best way is to write your tests first, before you write the code that passes them (TDD).
domenica 7 agosto 2011
A very minimal guide to the tar command
to extract from an archive
- for .tar use tar -xvf [archiveName]
- for .tar.gz, .tgz use tar -xvzf [archivefile]
- for .tar.bz2, .tbz2, .tbz use tar -xvjf [archivefile]
- for .tar.Z than use tar -xvZf [archivefile}
to compress a folder or a list of files
- for .tar use tar -cvf [archiveName] [pathname ...]
- for .tar.gz, .tgz use tar -cvzf [archiveName] [pathname ...]
- for .tar.bz2, .tbz2, .tbz use tar -cvjf [archivename] [pathname ...]
- for .tar.Z use tar -cvZf [archivename] [pathname ...]
[pathname ...] can be the path of a folder or the path of a list of files you want to compress.
to see the content of an archive, without extracting:
- for .tar use tar -tvf [archiveName]
- for .tar.gz, .tgz use tar -tvzf [archivefile]
- for .tar.bz2, .tbz2, .tbz use tar -tvjf [archivefile]
- for .tar.Z use tar -tvZf [archivefile}
Iscriviti a:
Commenti (Atom)