Flags
| Symbol | Meaning |
|---|---|
| A | Added → The file is newly added and staged for commit. |
| M | Modified → The file has been changed but not staged or committed. |
| D | Deleted → The file has been removed but the change is not yet committed. |
| R | Renamed → The file has been renamed. |
| C | Copied → The file has been copied from another file. |
| U | Unmerged (Conflict) → The file has merge conflicts that need to be resolved. |
| ?? | Untracked → The file is new and not tracked by Git. |
-u
The -u flag (short for --set-upstream) is used with git push to set the upstream (tracking) branch for your local branch. This means that after using this flag once, you can simply run git push or git pull without specifying the remote and branch.
If we don't use -u, we need to specify the branch whenever we want to push.
-message
The -m flag (short for --message) is used with git commit to provide a commit message directly in the command. This avoids opening the default text editor for writing a commit message.
Multi-line commit message:
git commit -m "Fixed the login issue" -m "Resolved bug where incorrect credentials were not handled properly."
If you run git commit without -m, Git will open your default text edittor to enter detailed commit message. git commit <message> will occur error.
--move
- Renames a branch only if the new branch name does not already exist.
- If the target branch name exists, the command fails with an error message.
--move --force
It's short form is -M
- Renames a branch even if the new branch name already exists.
- Forces the renaming by overwriting the existing branch.