Wednesday 29 August 2018

Git Workflow - Sample and Git Command Reference - Basics

Sample git workflow:

1) Checkout a new branch from "dev" named after the story you will work on. Branch should be named "feature/{storyNumber}-{story-name}"
2) Perform code changes in small commits. Refer to related story and tasks in the commit messages.
3) When finished (and locally tested), pull and merge again from branch "dev" into your feature branch. Fix potential conflicts locally.
4) After making sure all is good to go, let team members know during the next stand-up. Push your branch and submit a pull request so that your branch gets merged into "dev" branch again.

At later stage, dev branch will be merged into master and deployed.



git add . // to add newly created / modified files

git commit -m < inline comment>

git pull origin <branch_name>

git push origin <branch_name>





git status -> Shows the current status of the branch you are working.




git checkout <fileName> will undone the local changes

git checkout -f ---> force checkout all the modification



git stash ----> copies your changes into seperate location

git statsh list --> will show you all the changes 

git commit -a -m "message" - single command to add, commit and add message


to Create a branch

  - git branch <branch_name>
 
  to push local branch to remote
 
  - git push -u origin <branch_name>
 
 
  U can also use git flow to create a branch
 
   - git flow init
 
      Command to create a brnach using git flow
      git flow feature start <name of the branch>
 
  git flow feature publish // to publish the branch to remote
 


  to force all the changes to undone -> git checkout -f
 







To merge a Dev branch to master branch

- Verify you are in dev branch

1) git checkout master

2)git merge dev

3) git push

4) git chekout dev( In order to be back to dev branch)

No comments:

Post a Comment