Following are the git commands that I have required many times. So I have compiled them here.
- Adding remote repository and doing an initial push
git add *
git commit -m "My initial commit message"
git remote add origin firstname.lastname@example.org:my_project.git
git push -u origin master
For the bitbucket repository, fourth command can be changed as
git remote add origin https://email@example.com/username/repo.git
- Removing a file from remote repository which has been deleted from local repository
git commit -a -m "Message"
-a flag will delete the files which have been deleted on local repository.
- Undo git add a file if git commit is not done
git reset HEAD filepath