git
Convention:
git log --pretty=oneline file name
git show %H --name-only
git will bring all a editor with the following message: pick 8157e2b Test 1. pick 05532ed Test 2. (b) change the second 'pick' to 'squash', which means squash commit 2 (Test2) into commit 1 (Test1) (c) Save and quite. git will combine the two commits together and bring up a new editor. Like: # This is a combination of 2 commits. # The first commit's message is: Test 1. # This is the 2nd commit message: Test 2. Edit the message again and save and quite. Like Test1 && Test2 Successfully rebased and updated refs/heads/master. If you do a 'git log' after the combination, you will find the new combined log as follows: commit 77fd2899a713aefcb0d3369fe17d12d9552e5cec Author: Tony Jiang <name@email.com> Date: Mon Nov 14 20:03:34 2016 -0600 Test 1 && Test 2.
- %H: commit hash
- %h: abbreviated commit hash
- How to how logs of one given file
git log --pretty=oneline file name
- How to show just the file names changed in a patch?
git show %H --name-only
- How to do a git squash?
git will bring all a editor with the following message: pick 8157e2b Test 1. pick 05532ed Test 2. (b) change the second 'pick' to 'squash', which means squash commit 2 (Test2) into commit 1 (Test1) (c) Save and quite. git will combine the two commits together and bring up a new editor. Like: # This is a combination of 2 commits. # The first commit's message is: Test 1. # This is the 2nd commit message: Test 2. Edit the message again and save and quite. Like Test1 && Test2 Successfully rebased and updated refs/heads/master. If you do a 'git log' after the combination, you will find the new combined log as follows: commit 77fd2899a713aefcb0d3369fe17d12d9552e5cec Author: Tony Jiang <name@email.com> Date: Mon Nov 14 20:03:34 2016 -0600 Test 1 && Test 2.
Comments
Post a Comment