Some Useful git Commands

git status
shows pending changes that can be added to repo

git add -A
adds all pending changed files to pending commit list

git commit -a -m “Message”
commits all pending additions to the current branch with a message of “Message”

git push
pushes current branch to default remote

git push {branch name} {remote repo name}
pushes {branch name} changes to {remote repo name}

git reset {file name}
resets a file back to previous state after adding to pending commit list

git branch {branch name}
creates a branch named {branch name}

git checkout {branch name}
switches to a branch named {branch name}

git checkout -b {branch name}
creates and switches to a branch named {branch name}

git remote add {remote repo name} {remote repo uri}
adds a reference to a remote repo that can be pushed to

Leave a Reply

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