GIT --- push everything to a remote server, but with only one log entry

I make changes to the project on my machine and make several commits in this process. However, when I click on the remote server, I want all the changes to be sent, but only with the entry one .

That is, locally, I have commit1 , commit2 , commitN . When I push it to a remote server, I want it to show commitN in the history, but still push all the changes.

Is it possible?

+4
source share
2 answers

git rebase -i <hash-of-the-last-commit-before-commit1>

The editor will open with a list, for example:

 pick commit1 pick commit2 pick commitN 

Edit the lines this way:

 reword commit1 fixup commit2 fixup commitN 

Save and exit the editor.

The editor will open again - just enter the name of your final commit.

Now you can direct your single commit to the server.

+1
source

You can do this with interactive permutation, where you crush commits.

 git rebase -i <commit> 

Where is the parent of the last commit that you want to include when you click. Running this command will allow you to choose from which commits you want to steal into one. Assuming the commits you want to crush are the last 10 commits you would do this.

 git rebase -i HEAD~10 
+1
source

Source: https://habr.com/ru/post/1490276/


All Articles