# run command inside the root directory of the project to bundle including all branches
git bundle create reponame.bundle --all
# to bundle only the main branch
git bundle create reponame.bundle main
# to unbundle, use the following command
git clone reponame.bundle
# after cloning, you will see the bundle is set as default remote repository origin
git remote -v
> origin /home/user/projects/reponame.bundle (fetch)
> origin /home/user/projects/reponame.bundle (push)
# if you want to add a new remote repo as origin, you first have to remove the current origin repository, but this means loosing access to your branches etc.
git remote rm origin
# alternatively, you can provide a new name while cloning
git clone --origin <new_name> reponame.bundle
Tag: branch
[Git] Branch Commands
https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
https://git-scm.com/book/en/v2/Git-Branching-Branch-Management
# create branch, switch to it and commit changes
git checkout -b hotfix
git commit -a -m 'Commit changes for fix'
# go back to main branch
git checkout main
# merge branch changes to main
git merge hotfix
# delete branch after merging, as it is not needed anymore
git branch -d hotfix
# check on which branch your are
git status
# list all branches including last commit on each branch
git branch -vv
# check which branches are already merged and which are not
git branch --merged
git branch --no-merged
# rename branche locally
git branch --move bad-branch-name corrected-branch-name
# push new name to github/gitlab
git push --set-upstream origin corrected-branch-name
# displays local and remote branches
git branch --all
# delete remote branch
git push origin --delete bad-branch-name
# push branch to remote
git push origin hotfix