Get the status of your Git repository
To get the status of your local Git repository, you can use the status command. This will show you which files are untracked, which are added or removed and need to be committed.
git status
This command can give you a result that looks like the following:
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: BodyType.al
Untracked files:
(use "git add <file>..." to include in what will be committed)
Car.al
CarCard.al
CarList.al
no changes added to commit (use "git add" and/or "git commit -a")
This command gives you the other commands you can use to add or remove file. If we add the Car.al file to the staging area, you'll get the following result with the status command.
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: Car.al
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: BodyType.al
Untracked files:
(use "git add <file>..." to include in what will be committed)
CarCard.al
CarList.al
In the status overview, you can see a list of files within the staging area and the working directory. To compact the result, you can use the status -s option. It will display the files in a list. The first column will indicate the status of the file within the staging area, and the second column indicates the status of the file within the working directory.
In the next example, you can see the BodyType.al file is deleted in the working area (the second column) but hasn't yet been staged (there's no status in the first column). The Car.al is added to the staging area and has the status letter A. The other two files are both still untracked, so there's no status of the files within either the working directory or the staging area.
D BodyType.al
A Car.al
?? CarCard.al
?? CarList.al
To get a list of the commits that are executed on the Git directory, you can use the log command. The log command can also accept a number of options that will show more information on each commit.
git log
The basic log command shows a list of the commits with the author and date information, and the commit message.
commit e50111d6d92f0107e97924e5d9ee3c785a10e194 (HEAD -> master)
Author: Your Name <yourname@xyz.com>
Date: Tue May 12 15:40:29 2020 +0200
Initial Commit
If you use the -p option, it will also include the content and the difference in content with the previous commit.
commit e50111d6d92f0107e97924e5d9ee3c785a10e194 (HEAD -> master)
Author: Your Name <yourname@xyz.com>
Date: Tue May 12 15:40:29 2020 +0200
Initial Commit
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8e38d70
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+.alpackages/*.app
+*.app
+.vscode/launch.json
+.vscode/rad.json
diff --git a/BodyType.al b/BodyType.al
new file mode 100644
index 0000000..7fce165
--- /dev/null
+++ b/BodyType.al
@@ -0,0 +1,29 @@
+enum 50100 "Body Type"
+{
+ Extensible = true;
...
Other nice log options are --stat. This will show you how many lines per file were modified within your commit.
git log --stat
commit e50111d6d92f0107e97924e5d9ee3c785a10e194 (HEAD -> master)
Author: Your Name <yourname@xyz.com>
Date: Tue May 12 15:40:29 2020 +0200
Initial Commit
.gitignore | 4 ++++
BodyType.al | 29 +++++++++++++++++++++++++++++
app.json | 39 +++++++++++++++++++++++++++++++++++++++
3 files changed, 72 insertions(+)
The --graph option displays a graphical overview of your different commits, including different branches and merges. With the --pretty option, you can make the output easier and cleaner to read.
You have some options for pretty: oneline, short, full, fuller.
git log \--pretty=oneline \--graph
Within Visual Studio Code, the status is immediately displayed in the SCM window. The letters A, D, U, M, and so on, indicate the status for each file.