Git Quick Start [hubflow]

Recently, I joined project and we started using git but together with HubFlow.

So I decided to summarize all useful steps/flows/commands I’m using all the time.

FEATURE steps

git checkout develop
git hf feature start FL-001 #add files/changes for commit in appropriate way.
git commit –m “Commit message”
git hf push #create pull-request from your feature to develop. Merge.
git hf feature finish FL-001

RELEASE steps

git hf pull
git checkout release/sprint # || git hf release checkout sprint1 # - add files/changes for commit in appropriate way
git commit –m “Release message”
git hf push # create pull-request from your release to master. Merge.
git hf pull
git hf release finish FL-1-2

Add/Commit tandem commands

git status
git add -A # will add all files you added with git, and with no git.
git add . # will add ONLY modified files, which were already under git
git commit -a -m “Msg” - will do "git add ." and "git commit" together.
git commit -m “Msg”
git commit # will open default editor and ask you commit msg text
git config --list

Get Sources from Remote Repo to my Local Repo

git fetch origin
git fetch origin --all
git pull
git hf pull
git hf update

Work with Branches

git branch
git branch -r
git branch -a
git checkout feature/MY-feature-branch-name
git hf feature checkout MY-feature-branch-name
git remote
git remote show origin
git ls-remote –heads origin

Or u may cd .git and find there the file
Other resources regarding remotes: http://gitref.org/remotes/

How to incorporate changes from parent develop branch into your child branch/feature

git hf pull
git hf update
git rebase develop

Extreme Commands

git reset --hard
git push -u origin --all
git push origin master

Revert/Reset/Clean changes/files/folders

  • git revert [sha] – if you want to revert by commit hash ID
  • git reset --hard – in most cases when I want to reset all local changes in files.
  • git checkout file.txt – reset the file only.
  • git clean –f – removes all files added by U which are not under git yet in working tree.
  • git clean –f -d – removes all files added by U which are not under git yet in working tree.
    # -f here is FORCE, not file. Force is required by git to perform clean.
  • git remote update -p # || --prune – deletes all stale tracking branches under . These stale branches have already been removed
    from the remote repository referenced by , but are still locally available in
    “remotes/”

Git Changes Visualizer

$ gitk

Just hit and see 🙂

Cheatsheets:
http://ndpsoftware.com/git-cheatsheet.html#loc=workspace; – this is the best I think, but you may ask Google for more.

Other refs:
http://datasift.github.io/gitflow/TheHubFlowTools.html – how to install hubflow extension.
http://dev.datasift.com/blog/hubflow-github-and-gitflow-model-together and useful diagram below:

Advertisements

2 thoughts on “Git Quick Start [hubflow]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s