Ghidra: saving, archives, and a shared project
Save writes the program database. Exporting a Ghidra zip makes a portable copy of that database. A shared project adds checkout and check-in so a team can hand the same database around. None of these steps rewrite the executable you imported.
Save commits the open program
While CodeBrowser is open, your renames and comments are transactions on the in-memory program. File > Save Program writes them into the project repository. The tool will also ask when you close a program that has unsaved transactions. Undo and redo walk those transactions inside the session, including the transaction a script made. After a crash, or after you decline the save prompt, the project still holds the last save and nothing since. There is no silent second copy inside the executable.
Get into the habit of saving at the end of a lab section, when a small batch of names has settled, and before you run a long analyzer you might want to undo. A save is a point you can return to by ordinary discipline. It is not a version-control history. A local project does not keep every previous save. If you need that stack, you either export a zip at the milestone or you use a shared project’s check-in history.
A zip of one program, a copy of the whole project
File > Export Program offers several formats. The one that carries the analysis is the Ghidra Zip File, extension .gzf. It holds the program database: bytes as imported, names, comments, bookmarks, types, and function objects. Another person imports it into their project and sees your work. Exporting as a raw binary or as an ELF would be a different choice, and this lesson does not use it. Stay with the zip when the goal is to move the reading.
To back up the whole project, close Ghidra and copy the project directory, marker and repository together. Copying the repository while the tool has it open can capture a half-written file. The executables you studied should sit outside that directory, named and dated, so a restore of the project does not depend on a restore of the samples, and a delete of the samples does not take the notes with it.
Lab: save, export, and reopen the archive
Confirm the names and bookmarks from the earlier labs are on screen. Save the program. Export it as a Ghidra zip into the lab directory, outside the project folder, with a name that includes the build, such as harbor-check-o0-named.gzf. Create a second non-shared project, import the zip, and open the program. main, load_config, the plate comment, and the bookmarks should be there. The original executable’s modification time should be unchanged from the compile.
Write the log line in the sample. If you have a second machine or a classmate’s project to try the shared workflow, add the program to a repository, check it out, change one comment, check it in, and have the other person update. If you do not, the zip import is the whole handoff, and it is enough.
A lab log line that outlives the tool date, your name program: harbor-check-o0 language: x86:LE:64:default / gcc saved: names for main, load_config, status_text open question: none, or the Warning bookmark you still owe executable on disk: not modified
Diagram
Three files people confuse
- Edit
Renames, types, comments, and bookmarks are transactions in memory until you save.
- Save
File > Save Program writes this program into the project. Closing without saving drops the session’s transactions after a prompt.
- Archive
File > Export Program, format Ghidra Zip File, writes one program’s database to a .gzf you can import elsewhere.
- Team
A shared project on a Ghidra Server checks a program out to one writer and checks it back in with a version comment.
What each one contains
Role. The bytes you compiled or were given to study.
Who writes it. Your compiler, or the person who provided the sample. Ghidra’s Save does not.
Care. Keep it outside the project directory so a project backup is obviously analysis.
Role. The .gpr marker and the .rep repository: programs, names, comments, bookmarks, types.
Who writes it. File > Save Program, while the project is the open container.
Care. Copy the directory only when the project is closed. Export a .gzf of one program when you need to move just that database.
date, your name program: harbor-check-o0 language: x86:LE:64:default / gcc saved: names for main, load_config, status_text open question: none, or the Warning bookmark you still owe executable on disk: not modified
Check yourself
1. You renamed three functions and the power fails before you save. What is on disk afterward?
2. A teammate needs your named database of harbor-check and does not need the rest of the project. What do you send?
3. Two people need to work on the same program in a shared project. How does the handoff go?