Although some people prefer user interfaces, I prefer using the command-line to work with Git. In this article, I will review the simple sequence that I use most often.
First, I check out a branch. This might be the develop (integration) branch, or it might be a specific release.
git checkout <branch>
Next, I pull the latest code from the remote repository. This synchronizes the local files on my machine with the remote repository.
Then, I create my feature branch. I refer to this as a temporary container that keeps my work separate from everyone else’s until it is reviewed and approved.
git checkout -b feature/<feature name>
Next, I add, modify, or delete information. When I am done with my updates, I commit them to the working directory and then push the changes. However, I like to see the status along the way. After I have modified files, running the following command lists the file changes.
Committing changes moves them from my working repository to my local repository.
We have a hook that opens a text editor like Notepad++ where I enter my commit message. After I close the editor, the commit finishes. I often run another status check.
Now, it is time to push the content to the remote repository. Sometimes, the command needs more information. But, if I type the following, it returns the full Git push command that I can copy and paste.
Now, I am done with my command-line work! Next, I open a web browser and create a Pull Request in the Bitbucket repository so that my work is approved and merged into the develop branch.