Welcome to FreeSoftwareServers Confluence Wiki

https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches
https://discuss.gogs.io/t/i-cant-figure-out-how-to-create-a-branch/235

Story:

You have a dev server that should push to master:

git checkout devb
git push --set-upstream origin devb
touch devbfile
git add .
git commit -m "init"
git push origin master

git checkout master
git push --set-upstream origin master 
git pull origin devb
ls -la
git add .
git commit -m "init"


Pull:

git pull
git pull --no-edit origin dev

Commit:

git commit -a -m "Commit"

Mirror to new Repo:

git push --mirror ssh://...

List Branches:

git branch -a -vv

Create New Branch:

git checkout -b newbranchname

Checkout Existing Branch:

git checkout branchname

Push to Branch:

git push origin newbranchname
git push origin head:master
git push -f origin head:master

Set upstream:

git push --set-upstream origin newbranchname

Overwrite Local w/ Remote Branch:

git reset --hard origin/master
git reset --hard 0d1d7fc32
git pull

Rename Branch:

git branch -m <newname>

git push -u origin
git push origin HEAD
git push origin --delete master

Delete Remote Branch:

git  branch -d origin <branchname>
Delete a branch with git branch -d <branch> . The -d option will delete the branch only if it has already been pushed and merged with the remote branch. 
git  branch -D origin <branchname>
Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet.

https://stackoverflow.com/questions/36984371/your-configuration-specifies-to-merge-with-the-branch-name-from-the-remote-bu/36989364

Ref Issues

git remote prune origin
  • No labels