Say your bug fix branch is called bugfix
and you want to merge it into master
:
git checkout master git merge --squash bugfix git commit
This will take all the commits from the bugfix
branch, squash them into 1 commit, and merge it with your master
branch.
Explanation:
git checkout master
Switches to your master
branch.
git merge --squash bugfix
Takes all commits from the bugfix
branch and groups it for a 1 commit with your current branch.
(no merge commit appears; you could resolve conflicts manually before following commit)
git commit
Creates a single commit from the merged changes.
Omitting the -m
parameter lets you modify a draft commit message containing every message from your squashed commits before finalizing your commit.
Related Posts:
- How can I merge multiple commits onto another branch as a single squashed commit?
- What is the best (and safest) way to merge a Git branch into master?
- Undo a Git merge that hasn’t been pushed yet
- Squash my last X commits together using Git
- Git merge hotfix branch into feature branch
- Abort a Git Merge
- How to resolve merge conflicts in a Git repository
- The following untracked working tree files would be overwritten by merge, but I don’t care
- The following untracked working tree files would be overwritten by merge, but I don’t care
- Git error on commit after merge – fatal: cannot do a partial commit during a merge
- Is there a “theirs” version of “git merge -s ours”?
- .gitignore and “The following untracked working tree files would be overwritten by checkout”
- The following untracked working tree files would be overwritten by merge, but I don’t care
- .gitignore and “The following untracked working tree files would be overwritten by checkout”
- Is there a “theirs” version of “git merge -s ours”?
- Is it possible to pull just one file in Git?
- How to resolve git status “Unmerged paths:”?
- How to keep a branch synchronized/updated with master?
- Resolve Git merge conflicts in favor of their changes during a pull
- Found a swap file by the name
- Is there a git-merge –dry-run option?
- Git pull – Please move or remove them before you can merge
- How to use Git Revert
- How do I properly force a Git push?
- How to remove local (untracked) files from the current Git working tree
- Git submodule update
- What does ‘git merge –abort is equivalent to git reset –merge when MERGE_HEAD is present.’ of Git merge man page mean?
- How to modify existing, unpushed commit messages?
- How do I clone a specific Git branch? [duplicate]
- Git pushing to remote branch
- How to revert a merge commit that’s already pushed to remote branch?
- GitHub Error Message – Permission denied (publickey)
- Git : fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists
- How do I push a new local branch to a remote Git repository and track it too?
- How do you push a tag to a remote repository using Git?
- Gitignore not working
- How do I revert a Git repository to a previous commit?
- Update Git branches from master
- How to revert multiple git commits?
- Stash only one file out of multiple files that have changed with Git?
- Create a branch in Git from another branch
- How do I fix a Git detached head?
- What is HEAD in Git?
- Why does git say “Pull is not possible because you have unmerged files”?
- What are the differences between git remote prune, git prune, git fetch –prune, etc
- How can I git stash a specific file?
- How to get the current branch name in Git?
- How can I git stash a specific file?
- Move the most recent commit(s) to a new branch with Git
- What does “Git push non-fast-forward updates were rejected” mean?
- How do I diff the same file between two different commits on the same branch?
- You have not concluded your merge (MERGE_HEAD exists)
- How to get the current branch name in Git?
- Git – Ignore node_modules folder everywhere
- Git: cannot do a partial commit during a merge (SourceTree)
- Meaning of the GitHub message: push declined due to email privacy restrictions
- Is there a command to undo git init?
- How to undo ‘git reset’?
- Download a single folder or directory from a GitHub repo
- fatal: Not a valid object name: ‘master’
- Git and nasty “error: cannot lock existing info/refs fatal”
- Is there a “git touch” so I can push the same file with a new timestamp?
- Branch from a previous commit using Git
- Hard reset of a single file
- Hard reset of a single file
- How to remove remote origin from a Git repository
- Not a valid object name: ‘master’
- git add remote branch
- Undo a git stash
- Undo git stash pop that results in merge conflict
- Set up git to pull and push all branches
- Invalid VCS root mapping – 3 errors on my project
- Unity Collaborate vs GitHub
- What is the difference between pull and clone in git?
- How do I clone a single branch in Git?
- how to reset develop branch to master
- SourceTree keeps asking for Github password
- Git’s local repository and remote repository — confusing concepts
- How to change the license for a project at Github?
- How do i git push specific branch?
- Git add all files modified, deleted, and untracked?
- How to switch back to ‘master’ with git?
- Github Authentication Failed – … GitHub does not provide shell access
- How do I pull files from remote without overwriting local files?
- Your repository has no remotes configured to push to
- Specify an SSH key for git push for a given domain
- How do I “un-revert” a reverted Git commit?
- How to create a local branch from an existing remote branch?
- git push not send changes to remote git repository
- How to merge a specific commit in Git
- How do I clone a subdirectory only of a Git repository?
- How to use Git and Dropbox together?
- Git: Where exactly is the “working directory”?
- What exactly does the “u” do? “git push -u origin master” vs “git push origin master”
- Updating and committing only a file’s permissions using git version control
- Create empty branch on GitHub
- Git – fatal: Unable to create ‘/path/my_project/.git/index.lock’: File exists
- What is the usual process of saving changes made at the CMS level into source control?
- Add latest commit info on login footer using login_footer hook
- Display GitLab repositories of the logged in user on a page