git --version
git rm --cached new.file
git add *.html
also works on windows PowerShell
.gitignore
file. For example, if we don't want to include any .txt files, any files inside /docs directory, and also any .html files inside /dir, then the file will contain:*.txt
/docs
/dir/*.html
git branch
Lists all remote branchesgit branch -r
Lists all local and remote branchesgit branch -a
Creates new branch login
to work on login functionality on the branchgit branch login
Shows branches that are merged alreadygit branch --merged
Deletes the login
branchgit branch -d login
Deletes the login
branch (with force mode, which means - the branch will be deleted, even if it's not fully mergedgit branch -D login
login
branch into master
git merge login
Note: we must be on master branch if we want some other branch to merge on it
-u
flag adds a tracking reference to the upstream server that we are pushing to.
This lets us do a git push
without specifying other arguments.
For example, once we do a git push -u origin master
, we can later run git push
and git will know that we meant git push origin master