Use git show
to get the SHA1 commit ID of the current HEAD. With that information, you can’t lose those commits.
Then, switch to master and:
git merge abc123
where abc123
is the SHA1 from the first step.
Related Contents:
- How do I delete a Git branch locally and remotely?
- How do I discard unstaged changes in Git?
- How do I reset or revert a file to a specific revision?
- How do I change the author and committer name/email for multiple commits?
- Ignore files that have already been committed to a Git repository [duplicate]
- Undo working copy modifications of one file in Git?
- How can I undo git reset –hard HEAD~1?
- Get changes from master into branch in Git
- Download single files from GitHub
- Git: How to squash all commits on branch
- Should composer.lock be committed to version control?
- How to unstage large number of files without deleting the content
- Managing large binary files with Git
- Git – How to close commit editor?
- Git diff between current branch and master but not including unmerged master commits
- How can I create a Git repository with the default branch name other than “master”?
- Ignoring an already checked-in directory’s contents?
- Git: How to rebase to a specific commit?
- How do I do an initial push to a remote repository with Git?
- Git undo changes in some files [duplicate]
- Revert changes to a file in a commit
- Why is “origin/HEAD” shown when running “git branch -r”?
- Maintain git repo inside another git repo
- Git push: “fatal ‘origin’ does not appear to be a git repository – fatal Could not read from remote repository.”
- Git cherry pick vs rebase
- Should I add the google-services.json (from Firebase) to my repository?
- Difference between GIT and CVS
- Git pull from another repository
- How to perform better document version control on Excel files and SQL schema files
- Filter git log to show only my changes
- Recovering added/staged file after doing git reset –hard HEAD^?
- Is there a Github clone in PHP that I can run on my own server? [closed]
- How to Conclude a Git Cherry-Pick?
- Is it possible to alias a branch in Git?
- Git: checking out a file from a previous commit and amending it to HEAD
- Switching branches without touching the working tree?
- Creating branches on an empty project in git
- How do you undo “Discard all changes” in VS Code/Git
- How do you rename a Git commit pushed to GitHub?
- Git: How to make outer repository and embedded repository work as common/standalone repository?
- GitHub: How to do case sensitive search for the code in repository?
- How to create a new branch on both local and remote? GIT [duplicate]
- How to get Git diff of the first commit?
- Git cancel a revert
- Git merging within a line
- How do i delete the last 3 commits?
- Remove deleted files from git history
- Git “revert” current directory
- How does Git save space and is fast at the same time?
- Not showing as a contributor on GitHub