Engee documentation
Notebook

Using Git in Engee

This example presents the basic commands of the Git version control system, which can be seen as an alternative to using Git in the file browser and command line.

Before you start, connect the engee_git.jl module :

In [ ]:
include("$(@__DIR__)/engee_git.jl");

and navigate in a file browser to the directory where you want to perform version control.

Creating and deleting a Git repository

  • Initialise a local repository in the current directory:
In [ ]:
engee_git.init();
  • Clone a remote repository into the current directory:
In [ ]:
engee_git.clone_url = "git@git.engee.com:namespace/repository.git";
In [ ]:
engee_git.clone(engee_git.clone_url);
  • Delete repository from current directory:
In [ ]:
engee_git.term();
  • Bind a local repository to a remote repository:
In [ ]:
engee_git.remote_url = "git@git.engee.com:namespace/origin.git";
In [ ]:
engee_git.remote(engee_git.remote_url);

Changing a local repository

  • Display the current status of the repository:
In [ ]:
engee_git.status();

Change Indexing

  • Index changes to all files in the working directory:
In [ ]:
engee_git.index_add();
  • Index the change of the specified files:
In [ ]:
engee_git.index_add_files = "file1.txt file2.txt";
In [ ]:
engee_git.index_add(engee_git.index_add_files);
  • Cancel change indexing of all files in the working directory, preserving their current state:
In [ ]:
engee_git.index_reset();
  • Cancel indexing of changes to the specified files, saving their current state:
In [ ]:
engee_git.index_reset_files = "file1.txt file2.txt";
In [ ]:
engee_git.index_reset(engee_git.index_reset_files);
  • Stop tracking changes to the specified files:
In [ ]:
engee_git.index_remove_files = "file1.txt file2.txt";
In [ ]:
engee_git.index_remove(engee_git.index_remove_files);

Commit changes

  • Commit changes:
In [ ]:
engee_git.commit_message = "Initial commit";
In [ ]:
engee_git.commit(engee_git.commit_message);
  • Change the last commit without changing the comment:
In [ ]:
engee_git.commit_overwrite();
  • Change the last fixation with overwriting the comment:
In [ ]:
engee_git.commit_overwrite_message = "New commit";
In [ ]:
engee_git.commit_overwrite(engee_git.commit_overwrite_message);

Return to last committed state

  • Return the repository to the last committed state:
In [ ]:
engee_git.reset();
  • Return the specified files to the last committed state:
In [ ]:
engee_git.reset_files = "file1.txt file2.txt";
In [ ]:
engee_git.reset(engee_git.reset_files);

Conclusion diagnostic information

  • Output the history of change recording:
In [ ]:
engee_git.log();
  • Output a comparison of indexed changes with the current state of files in the working directory:
In [ ]:
engee_git.diff();
  • Compare the last committed state with the indexed changes:
In [ ]:
engee_git.diff("index");
  • Output a comparison of the last committed state with the current state of the files in the working directory:
In [ ]:
engee_git.diff("directory");
  • Output information about committing changes with the specified hash:
In [ ]:
engee_git.commit_show_hash = "engee123456789abcdefghijklmnopqrstuvwxyz";
In [ ]:
engee_git.commit_show(engee_git.commit_show_hash);

Interacting with a remote repository

  • Get changes from a remote repository:
In [ ]:
engee_git.fetch();
  • Get changes from a remote repository and merge with the current branch:
In [ ]:
engee_git.pull();
  • Send committed changes to the remote repository:
In [ ]:
engee_git.push();
  • Force to send committed changes to a remote repository:
In [ ]:
engee_git.push("force");

Branching

  • Output a list of repository branches:
In [ ]:
engee_git.branch_show();
  • Switch to an existing branch:
In [ ]:
engee_git.branch_switch_name = "master";
In [ ]:
engee_git.branch_switch(engee_git.branch_switch_name);
  • Create a new local branch:
In [ ]:
engee_git.branch_create_name = "dev";
In [ ]:
engee_git.branch_create(engee_git.branch_create_name);
  • Create a new local branch and switch to it:
In [ ]:
engee_git.branch_create_switch_name = "feature";
In [ ]:
engee_git.branch_create(engee_git.branch_create_switch_name, true);
  • Rename the current branch:
In [ ]:
engee_git.branch_rename_name = "main";
In [ ]:
engee_git.branch_rename(engee_git.branch_rename_name);
  • Delete a branch:
In [ ]:
engee_git.branch_remove_name = "feature";
In [ ]:
engee_git.branch_remove(engee_git.branch_remove_name);

Conclusions

This example demonstrates an alternative way of working with the Git version control system in Engee.

In addition to using the Git tab in a file browser or directly typing commands into a terminal, you can run the cells in this script sequentially from a local repository.

If necessary, you can create your own script to automate work with the Git version control system in the same way.