The ReadyAPI UI provides access to some of the most widely used Git commands, as described in the previous topics of the section. However, there are commands that cannot be performed via the UI. This is where the console proves to be useful: it allows you to run all Git commands.
ReadyAPI uses the Git Bash console. It is a Linux-based command line that has implementations for Windows and macOS. All the commands in Git Bash are identical on all the platforms.
Tip: |
For a reference on Git Bash commands, visit the https://git-scm.com/docs page, or run the git help command in the console. |
To set up the Git console:
-
Click Git on the main toolbar.
-
Click and select Setup Git Console:
Click the image to enlarge it.
-
On the Git tab that opens, enter the path to the installed Git Bash console in the Path to Git console field. You can click the Browse button and browse for the file.
Click the image to enlarge it.
-
Click OK.
-
Make sure your project is a composite project.
-
Right-click a project node in the Navigator and select Git > Setup Git Console from the context menu:
Show image
— or —
Select Project > Git > Setup Git Console from the main menu:
Show image
-
On the Git tab that opens, enter the path to the installed Git Bash console in the Path to Git console field. You can click the Browse button and browse for the file.
Click the image to enlarge it.
-
Click OK.
To launch the Git console after setting it up:
-
Click Git on the main toolbar.
-
Click and select Open Git Console:
Click the image to enlarge it.
The console will launch:
Note: |
When you launch the Git console, the current working directory is set to the folder of the project from which you launched the console. |
Launch console via the Git project menu
Below, you will find some examples of typical tasks that you can perform with the Git console.
Do the initial push to an empty repository
Do the initial push to an empty repositoryDo the initial push to an empty repository
-
Create a new empty repository on GitHub. You can read about it here: https://help.github.com/articles/create-a-repo/.
|
Do not initialize the repository with a README. |
-
Launch the Git console in ReadyAPI. In the console, run the following commands:
-
Initialize the working directory as a Git repository:
-
Stage all the files in the working directory for a commit:
-
Commit the staged files:
git commit -m "<Your commit message here>"
-
Set the URL of the remote repository where the commit will be pushed:
git remote add origin <Repository URL>
-
Push the commit to the main
branch of the remote repository:
Commit and push to the remote repository
Commit and push to the remote repositoryCommit and push to the remote repositoryLaunch the Git console in ReadyAPI. In the console, run the following commands:
-
Stage all the changes in the working directory for a commit.
-
Commit the staged files.
git commit -m "<Your commit message here>"
-
Push the commit to the remote repository.
Update from the remote repository
Branch from main branch
Branch from main branchBranch from main branchLaunch the Git console in ReadyAPI. In the console, run the following commands:
-
Create a new branch named development
and switch to it:
git checkout -b "development"
-
Push the new branch to the remote repository:
git push origin development
Merge into main branch
Merge into main branchMerge into main branchLaunch the Git console in ReadyAPI. In the console, run the following commands:
-
Switch to the main
branch:
-
Merge the development
branch into the main
branch:
-
Push the changes to the remote repository:
Change the URL of a remote repository
Change the URL of a remote repositoryChange the URL of a remote repositoryLaunch the Git console in ReadyAPI. In the console, run the following commands:
-
Get the name of the remote repository:
-
Change the URL of the remote repository:
git remote set-url origin <new URL>