6 Things To Do Before Pushing In Git Like Professional

6 Things To Do Before Pushing In Git Like Professional

If you have done any work in git than you must be familiarize with the word “git push”. If you are beginner in version control or git then you might get confused what should be done to push your changes. Here are few rules that professional follow before pushing anything in version control like github, bitbucket. The basic six rule you must keep in mind before pushing.

Step 1: git branch
It’s good habit to check in which branch you are working before pushing.

Step 2: git status
Check status of any changes in the files. You might have mistakenly changed other important file that should not be changed.

Step 3: git add <file/files>
After git status you will be known which files have been changed. Then, add only those files whose changes should be staged in staging area.
eg. git add application/modules/icuser/views/icuser/index.php

Step 4: git commit -m “your relevant message for the changes”
Before git push it’s compulsory you must commit to that changes. Give relevant message so that you can know what changes are done by seeing the message.
eg. git commit -m “Bug fix on user profile”

Step 5: git pull origin your-branch
Most important thing while you are doing collaborating work with other your code in remote might be outdated. So, its better you should first pull the new changes in your branch.
eg. git pull origin ic-user

Step 6: git push origin your-branch
Finally, you have waited eagerly to push your changes. You can simply push in your branch by using “git push”.
eg. git push origin ic-user

Leave a Reply

Your email address will not be published. Required fields are marked *