There are several basic git commands we should know.
git status
: Shows current status of files in a git-registered directory.git add [file / file directory]
:Stages
files or files under the directory. Files declared in.gitignore
file will be excluded.
Note If you commit some files and that file becomestracked
, it cannot be excluded by.gitignore
. You need to delete the file first and then commit first in order to exclude the file.git commit -m "[message]"
: Commit with the message you want.git push [local dir] [remote]
: Upload files to your remotegit checkout -b "[branch name]"
: create a branch, and shift to that branch.git log
: shows log of your git activity.git reset HEAD [id]
: you can reset your git status to the point of the id.git checkout [HASH]
: lets you observe the files at that specific log time.git merge [branch]
: merge the other branch into current branch.git merge --abort
: aborts your merge when it has conflicted.