Details
There are some cases I need to use some specific git commands for some special purposes, like
- Undoing git merge which haven't be pushed
- git reflog (Get the commit desired to return)
- git reset --hard sha
- Cherry-picking specific file changes from 1 commit to another
- git checkout <branch or sha of commit> -- filename
- Retrieve just 1 file from specific branch
- git checkout experiment -- app.js
- Show content changes which have been staged
- git diff --cached
- Show the diff of the same file between different commits of the same branch
- git diff HEAD^^ HEAD someFile (Show differences of someFile 2 commits before HEAD)
- Show file changes on specific commit (without diff information)
- git show --pretty="" --name-only {commit-sha}
- Show commits differences between 2 branches since branch created (file list)
- git log --oneline master..myBranch (Show changes since master branch)
- git log --oneline --no-merges master..myBranch (Show changes since master branch skipping merge commits)
- Get a list of branches created ordered with create date
- git branch --sort=-committerdate # DESC
- git branch --sort=committerdate # ASC
- Commit with standard input
- echo -e 'Update version number to v1.6.72.0\n\nfrom v1.6.70.0 to v1.6.72.0' | git commit /home/jacky/Documents/gitproj/p2_controller/docker/docker-compose-prod.yml /home/jacky/Documents/gitproj/p2_controller/docker/docker-compose-prod-upgrade.yml /home/jacky/Documents/gitproj/p2_controller/p2_controller/static_data/VERSION -F -
- Undo a Git merge that hasn't been pushed yet
- show commits since branch creation
- How to list all the files in a commit?
- How to cherry-pick changes from one file to another file?
- View git log without merge commits
- how-do-i-diff-the-same-file-between-two-different-commits-on-the-same-branch
- How to get just one file from another branch
- How can I get a list of Git branches, ordered by most recent commit?
- How do I show the changes which have been staged?
沒有留言:
張貼留言