The procedure for routine work on git.
Step 1: Clone the repository on your local machine by running the command given on the bitbucket site.
- git clone https://mksaini@bitbucket.org/mksaini/test.git
Step 2: At any time, before you start editing the code, update your local repo with latest commits with the following command:
Step 3: Make your changes in the files and commit the changes
- git commit -m "Committing changes" -a
Step 3.1: In case you have added a new file or folder to the repo, or you want to commit only particular file or folder, you need to specifically add that before running the above mentioned commit command (in that case, the commit command should be run without option "a"):
Step 4: Push the changes to the remote repo, i.e., reflect the commit in the remote repo:
- git push -u origin master
The procedure for putting code in a new repo:
Step 1: Create a new repo on bitbucket (it is better to use the same name for the repo your local project folder)
Step 2: Go to you project folder and delete any previously present git files in there
Step 4: Configure it for the remote repository. You can find the command to do that on bitbucket itself. To get that, select you repo, and then select "I am starting from scratch":
- git remote add origin https://username@bitbucket.org/your_repo.git
Step 5: Add all
- git commit -m "My first commit"
Step 7: Push the changes to the remote repo (i.e. save on bitbucket)
- git push -u origin master