Git Commands
Git Commands
git init -> create empty Git repo (create space to store the snapshots)
git commit -m 'comment' -> immediately add the commit comment on the command
git commit --amend -> to fix changes on the current commit instead of making a new
commit
Invoke-Item .\index.txt [w ps] -> open the file in the default app
git diff .\index.txt [mac] -> show the diff between staged & unstaged commit file
to merge:
go back to the master branch
git merge {branch-name to be merged with master} -> merge branch-name dengan branch
sekarang
after merge:
delete the other branch
git branch -d {branch-name}
======== ALIASES ========
git config --global alias.s status -> set 's' as the alias for status (git status -
> git s)
git stash -> stash away what we are working on temporarily instead of commit reset
etc.
git stash list -> check stash
git stash apply -> return the stash but it will still be in the stash list
git stash pop -> return stash and delete it from list
git stash branch {branch-name} -> apply stash from a different branch to branch-
name