Pitch your project

Random text






Blogs

0    
By admin Category Uncategorized, Posted February 16th, 2016
Becoming a Git Guru

Of late I have become somewhat of a Git Guru, making commitments like its trending, I wish it was, so lets get to work.
When you’re working on a large scale project, you get user-stories, this user-stories get broken down into smaller tasks called sprints, where the sprints can be done weekly or bi-weekly, so each user story will need its own feature branch which at the end of the sprint will be merged into the master branch before deployment, so how do we create this “feature branches”?

Git Create Pull Request

When you are starting on a new story create a feature branch

git checkout -b <branch -name> / feature

example:
git checkout -b implementing-grunt-file-into-POM/feature

From the feature branch create a sub-feature branch
“`
git checkout -b /

example:

git checkout -b implementing-grunt-file-into-POM/grunt-POM-merger

PS: check that you are in the *feature branch*, with

git branch

or

git status

you will get something like

On branch add_courses

Changes to be committed:
(use “git reset HEAD …” to unstage)

    deleted:    src/main/java/org/codepamoja/hhs/data/services/LinkssService.java
    deleted:    src/main/java/org/codepamoja/hhs/rest/TimeFrameResource.java

Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout —
…” to discard changes in working directory)

    modified:   src/main/resources/ebean.properties

######NOW WE WRITE OUR CODE (also referred to as INCREMENT) When we are done:

git add -p


This adds file contents to the index, i.e all the files that registered a change will be added to index for their changes to be committed. then

git commit -m “Commitment message”


######AND DO NOT PUSH! First we merge our feature branch into the sub-feature branch. Why? Because someone else could have made changes on the feature branch, which will lead to **conflicts**. So:

git-merge BranchName –

Join two or more development histories together

git checkout –


Back to the last branch, which should be feature.

git pull –

Make sure that we have the last version of the feature branch.

git checkout –

Then we go back to sub-feature.

Which should be the last branch Then on sub-feature:

git merge


Example:

git merge implementing-grunt-file-into-POM/feature


>If there are conflicts, fix them in your code editor or IDE When everything is fixed we can push the code

git push origin branchName
“`

Now we can create a pull request!

Posted by Michael Mathenge

Leave a Reply

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