Skip to content

Latest commit

 

History

History
54 lines (30 loc) · 1.11 KB

File metadata and controls

54 lines (30 loc) · 1.11 KB

create new branch from another

git checkout -b new-branch old-branch; git push --set-upstream origin new-branch;

checkout a branch

git checkout branchname

Merge code from feature branch 'dev-branch' to master

git add –A git commit –m "Some commit message" git checkout master Switched to branch 'master' git merge dev-branch (this is to merge changes from dev-branch to master) git push (push changes in master branch)

git commit history

git log --pretty=oneline

delete branch locally

git branch -d localBranchName

delete branch remotely

git push origin --delete remoteBranchName

The command to list all branches in local and remote repositories is:

git branch -a

If you require only listing the remote branches from Git Bash then use this command:

git branch -r

You may also use the show-branch command for seeing the branches and their commits as follows:

git show-branch

If you want to rename a branch while pointed to any other branch

git branch -m oldname newname

If you want to rename the current branch

git branch -m newname

list content

ls - ltrh