Your first repository
Create a local repository, commit a file, and undo the commit.
MarkdownBefore you begin
Use a disposable local repository for this exercise. You need Apple's Command Line Tools or Xcode, or Full Git Integration. You also need a global Git name and email configured in Settings > General. See Configure Git and external tools. In Basic mode, Git reads that name and email only if GitLode can read your home folder. See Folder access. You do not need a remote repository or a diff tool.
Create and commit a file
- Open the toolbar's plus menu and choose New Repository.
- Choose a new folder named
gitlode-practicein a location you can find in Finder. - In a text editor, create a file named
hello.txtinside that folder. EnterMy first commit.and save it. In TextEdit, choose Format > Make Plain Text before saving. - Return to GitLode and select Working Changes, or press Command+1.
- Select the checkbox beside
hello.txt. A checked file is staged, which means its changes are included in the next commit. - Enter
Add hello filein the commit message field, then click Commit. - Select the new commit in history. Check its message and changed-file list. Select
hello.txtand press Space to preview the committed file.
Undo the commit
- Click the history list to move focus outside the message editor.
- Choose Edit > Undo Commit. You can also open Activity with Command+0, select the commit operation, and click Undo.
- Return to Working Changes. Check that
hello.txtis still present and staged, and that the commit message has returned.
You can edit the file or message and commit again. For other operations and recovery limits, see Undo an operation.