


If you encounter this error when saving: error: cannot 'squash' without a previous commitīe careful not to merge previously committed things, that is, records that have been committed to the remote branch.Ĥ. Modify your commit history as follows: s cacc52da add: qrcode s f072ef48 update: indexeddb hack s 4e84901a feat: add indexedDB floder p 8f33126c feat: add test2.jsģ. x, exec = run command (the rest of the line) using shell.f, fixup = like “squash”, but discard this commit’s log message.s, squash = use commit, but meld into previous commit.e, edit = use commit, but stop for amending.r, reword = use commit, but edit the commit message.There are a few commands to be aware of, and here they are: # However, if you remove everything, the rebase will be aborted. # If you remove a line here THAT COMMIT WILL BE LOST. s cacc52da add: qrcode s f072ef48 update: indexeddb hack s 4e84901a feat: add indexedDB floder s 8f33126c feat: add test2.js # Rebase 5f2452b2.8f33126c onto 5f2452b2 (4 commands) # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # d, drop = remove commit # These lines can be re-ordered they are executed from top to bottom. At this time, it will automatically enter the vi editing mode. Let’s merge the last four commit records and execute.Ģ.This command is not too difficult, and it may be due to unfamiliarity, so let’s learn it through examples.
Rebase with master git how to#
Rebase Scenario 1: How to Merge Multiple Commit Records?īased on the problems mentioned above, it is not difficult for us to think of each time a function is developed or multiple commits are merged.Īt this time, you need to use git rebase. If there is an urgent problem on the line one day, you need to roll back the code, but you find that a large number of commits need to be read one by one.įollow the project specification to improve the efficiency of team collaboration, not arbitrary.
Rebase with master git full#
Your project is full of useless commit records. Imagine that you are going to do a code review, and the result is a small feature that has been submitted more than 60 times. The following will eventually cause problems: Let’s not talk about the git commit specification here so many useless commits are very uncomfortable.
