πGit Command
Describe about Git status and popular Git command
Git Status including 3 status:
modified = file that has been changed.
staged = file that was tracked to be snapshot for new commit.
commit = file that was kept in snapshot.
What is origin ?
ans: Origin is alias for remote repository url.
Git command :
git init = Initilize git repository on existing deirectory.
gitz add <file_name> = Add file to stage status before commit.
git reset <file_name> = Remove file from stage status.
git commit [options] = Add staged file to commit (snapshot) . Example Option
-n = no verify
-m = add description of this commit
git diff [options] = Show diffirent between each commit , can use for compare commit.
git branch [options] <branch_name> = List , create or delete git branch. Example Option
-l = show list of branch (default)
-d = delete branch
git checkout <branch_name> = Switch branch.
git merge <target_branch_name> = Merge target branch to existing branch by using code from local but when you use git pull origin master , it will use
git fetch + git merge (default) but you can change it to rebase by update git config
.git fetch = Fetch every branch from remote repository.
git pull = Fetch every commit from that local branch.
git push = Send every commit from current branch to remote repository.
git rebase <branch_name> = rebase the selected branch to current branch.
git revert <commit_number> = Revert commit from current branch.
git stash = Store modified or staged file to stash. We always use this command when we want to change branch but we don't want to commit file that we changed.
git stash pop = Pop the latest code inside stash to current branch.
git stash list = Show list of code inside stash.
git stash apply <stash_name> = It same as git stash pop but we specify stash name.
git stash drop = Remove latest code from stash.
git cherry-pick <commit_number> = Add specific commit to current branch.
Last updated