Saturday, November 17, 2018

Git commands

Below I list several Git commands which may be of use especially if you are a novice.

1) git init initializes Git
2) git commit -m "commit-message" commits changes and adds a message
3) git add -u updates all changes
4) git branch branch-name creates a new branch
5) git checkout branch-name changes the selected branch to the one named in this command
6) git flow feature start my-feature starts a new feature called "my-feature," based on 'develop', and checks out this feature
7) git flow feature finish my-feature finishes a feature called "my-feature," that is: merges the feature into the 'develop' branch, deletes the feature branch, and checks out 'develop'
8) git stash hide the current uncommitted changes and save them until later
9) git config --list shows all current settings 
10) git commit --amend -m "New commit message" amends last commit message 

Important notes:
  • -m is message, and after that you add the message in inverted commas (-m "your message").

No comments:

Post a Comment