Start on the Project
To create a local release control environment, you must initialize git in the project:
$ git init
After making changes to the project or even wanting to verify what has changed in your project, use the git status command:
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file> ..." to include in what will be committed)
file.txt
There are two ways to add a document or project to git:
- <git add "file name" >. Add selected files.
- <git add. >. Adds all files.
Note: The document has only been appended, it has not been saved.
$ git add.
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file> ..." to unstage)
new file: file.txt
The file has been added, and to undo it, you can use <git rm --cached <"file name"> >
TO SAVE THE INFORMATION WE MUST COMMIT:
- Write a commit:
$ git commit -m "first commit"
[master (root-commit) 3218596] first commit
1 file changed, 2 insertions (+)
create mode 100644 file.txt
If you do <git status > again, git will respond that it has nothing to commit.
Notes:
- This process should be done repeatedly throughout your project, if you have any changes, follow these steps.
- git recognizes when you modify the contents of your file.
After multiple commits, you can see all of the commits made, using the command <git log >
$ git log
commit bfaf604070febd3eb00d9abed717c47f045974a2 (HEAD -> master)
Date: Tue Jul 14 21:56:12 2020 -0300
third commit
commit 0ede13030b31a63d77d61347cc9328c268bbaf8f
Date: Tue Jul 14 21:55:17 2020 -0300
second commit
commit 321859681d76308922564cc063a5ab8e2b93946f
Date: Tue Jul 14 21:43:40 2020 -0300
first commit
The command: git log works, displays the history of any commits made.
INFORMATION ABOUT HOW TO MAKE A COMMIT::
- Leave the message clear, many developers use ** gerund , for example, writing, correcting, but it can also be done in indicative **, which makes it more correct, for example: "write", "add "," fixes ".
- Simply write things related to what you did on the project, e.g., NEVER put, "test", "commit to another person"..
- When fixing a bug, EXPLAIN the bug, never set: fix the bug. "," Fix bug ."
- Keep the norm of history, if this is English, always write English, if this is a gerund, always write in gerund.