Add all files to be saved
git add .
Save changes offline
git commit -m "Changed something comment"
Push changes to online server
Undo local changes and save them if you want to revert again
# delete stash
git stash drop
Apply new gitignore
# "cache/" is the file or folder you want to remove tracking
git rm -r --cached cache/
git add .
git commit -m ".gitignore is now working"
Remove remote origin to reupload files to source control provider
git remote remove origin
Upload repo to source control provider
git remote add origin https://email@example.com:7999/yourproject/repo.git
git push -u origin master
# list local branches
# create a new branch
git checkout -b new_branch
# switch to a branch
git checkout branch_name
# merge the new branch to master branch
git checkout master
git merge --squash new_branch
git commit -m "new_branch and master branch merged"
Delete a branch
# delete a local branch
git branch -d branch_name
# force delete a local branch
git branch -D branch_name
# delete a branch on github/bitbucket
git push remote_name --delete branch_name
Use git to maintain website in server