Forum > Beginners

How to revert my mess (repository)

<< < (2/3) > >>

SymbolicFrank:
It is very easy in Git to make a mistake and lose all your work. As long as you only check in periodically, you're probably fine. Everything more than that is dangerous.

af0815:

--- Quote from: PascalDragon on July 13, 2022, 09:03:41 am ---Git does not require a server, SVN does.
--- End quote ---
For simple usage, you can use the "file://" Protokoll special for Tortoise SVN instead a server. For a single user maybe acceptable.

(Source: https://tortoisesvn.net/faq.de.html#reponoserver in german)

PascalDragon:

--- Quote from: SymbolicFrank on July 13, 2022, 12:06:23 pm ---It is very easy in Git to make a mistake and lose all your work. As long as you only check in periodically, you're probably fine. Everything more than that is dangerous.

--- End quote ---

I have yet to manage that and privately I use Git quite a bit longer than when FPC/Lazarus switched over to Git.


--- Quote from: af0815 on July 13, 2022, 12:10:52 pm ---
--- Quote from: PascalDragon on July 13, 2022, 09:03:41 am ---Git does not require a server, SVN does.
--- End quote ---
For simple usage, you can use the "file://" Protokoll special for Tortoise SVN instead a server. For a single user maybe acceptable.

(Source: https://tortoisesvn.net/faq.de.html#reponoserver in german)

--- End quote ---

I wasn't aware of that, but even then I'd still prefer Git there, cause if I need remote abilities everything is already there (e.g. pushing the repository to a separate computer for testing).

Martin_fr:

--- Quote from: SymbolicFrank on July 13, 2022, 12:06:23 pm ---It is very easy in Git to make a mistake and lose all your work. As long as you only check in periodically, you're probably fine. Everything more than that is dangerous.

--- End quote ---

Off topic, but IMHO not true.

1) git with server (compare with svn(
If you do push, then your git data is as save as any svn data is.
If you "screw up" your local site: Backup, Delete, and clone from server.
Btw "screw up" means simple getting your repo into a state where you as beginner do not know how to get back to access the data (it's not lost, you may just not know how to access it / you can still ask for help).

I am aware of "force push", but even then:
- As a beginner you are unlikely to do force push.
- Yet if you done that, the safety nets below still apply (client and some server side).

2) Local only.
The only mistake, that really will loose all your data: Delete the (contents of) .git directory.

Btw, If your svn server runs locally, you can do the same with the svn server dir.
And if you want a 2nd local dir, with git you can push to a 2nd repo dir, without needing a server.

Anything other that the above "delete .git" mistake, and your data is still in git. 
(Well, ok, if you do force a (IIRC) "git prune --expire=now" ... but then again, if you know that command, you know where your data is)

If you screw up, you may have to ask how to get your data. But it is still there.

- local git has a "reflog" for each branch (by default 6 weeks). So anything you had in those 6 weeks will be in there (as long as you still have the branch / or if it was reachable under HEAD).

- git (local and server) keep data, even if you delete the (only) branch that holds the data (or reset the branch, and even if you made other commits, or amend a commit, or....).
IIRC by default for 2 weeks.
You can get it back (like undelete for a filesystem). You need the sha1, which "git fsck" can get you.



The only thing that does apply is: There are certain mistakes a beginner can easily make under git, and as a result of those you might easily get your repo into a state that you will need help to recover from.
This is IHMO especially true, if you still insist on learning the old "git checkout" command, rather than the newer "git switch" / "git restore" commands.

avra:

--- Quote from: Nicole on July 12, 2022, 07:15:38 pm ---What would you recommend me as backup for snapshots and backup for source?
I would like to:
1) Generate snapshots to revert if I brought myself into a dead end once again? - for work in progress
2) Which files shall I include in backups? lpr, pas, lfd..... is there a list anywhere? - for finished coded projects

It shall remain as slim as possible.

--- End quote ---
Although GIT is recommended, there are times when you need to complement or replace it with a simple backup solution. Copy below code to arc.bat file, have 7z command line executable from 7-zip package somewhere in the path, adapt BAT file to your needs, and call that BAT file each time you need to archive your project. It will create YYYYMMDD.zip file according to current date, and you can add your comments to that file name easily.


--- Code: DOS  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---REM archive file name should be: YYYYMMDD.zipset archivefilename=%date:~10,4%%date:~7,2%%date:~4,2% REM delete old file name if it existsdel %archivefilename%.zip /q REM pack everything important from all dirs to archive7z a %archivefilename%.zip -tzip -mx9 *.* -x!*.bat -x!*.exe -x!*.dbg -x!*.log -x!*.db -x!*.bak -x!*.zip -x!*.7z -x!*.mht* -x!*.pdf examples\s7demo\*.* -x!examples\s7demo\*.exe -x!examples\s7demo\backup\*.* -x!examples\s7demo\lib\*.* examples\simple-led-demo\*.* -x!examples\simple-led-demo\*.exe -x!examples\simple-led-demo\backup\*.* -x!examples\simple-led-demo\lib\*.* 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version