What can you recover from Git?
You can recover the contents Git recorded in a commit if you can reach a copy of that history. The first useful habit is to record a working version before trying a bigger change.
The project folder and its recorded history form a repository. Saving in your editor changes a file in that folder. To record it in Git, choose the files or changes to include and make a commit with a short description.
Open the recorded version before you rely on it. If the last working booking page was never committed, or the only copy was on a missing computer, another copy of the project may have an older version.
How do you save a change you can understand later?
Make one change small enough to describe in a sentence. Compare the files before and after, then record only the part you intended.
- Use a separate practice folderInstall Git or use a visual client. Open a disposable booking page with fake content. Check the confirmation and make the starting commit. Keep passwords, private settings and customer records outside the repository.
- Try the edit on a branchStart a branch from the working version and change only the button label. Compare the files with the previous version and open the page to confirm the button still works.
- Record the intended changesChoose the changes to include. Name the commit “Clarify the booking button label.” Open the history and check that the named commit contains the edit you meant to record.
How do you reverse a change that is already recorded?
Revert the specific commit to create a new commit that reverses its changes. This leaves a record of both what happened and what you undid.
Start with the change that caused the problem. Make sure you have kept your current work, then try the reversal on a practice branch. Check the app again after the revert.
A newer edit may depend on the earlier one. If Git asks which changes to keep, inspect the overlap and test the result. If you only need to see what an old version contained, inspect that version before making any change to the current branch.
What should you keep in another copy?
Keep the commits, branches and tags you rely on somewhere separate from the computer you use to build. Check that you can open the recorded version from that copy.
A remote is another repository Git can reach. Sending a branch shares its recorded history. Before relying on that copy, open the remote, confirm the needed branch arrived and try a new clone, which is a fresh copy of the repository.
Git is open source under the GPL version 2 and has no subscription charge. Hosting and separate backup storage have their own costs. Keep customer data, uploads and credentials with the services or private backups intended for them.