In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to improve the efficiency of Git development, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
1. Check out a single file from a branch
Have you ever destroyed a file and want to start over?
Or is the required file in another branch?
The following command allows you to fetch that file directly from a branch.
Git checkout some-other-branch-yarn.lock
You can also fetch the yarn.lock file from a commit
Git checkout 9146467-yarn.lock
Instead of cherry-pick getting all the files in a commit, this technique can get only the one file you want.
two。 Filter out merge commits when viewing logs
Merging with merge results in a new submission, which is sometimes annoying. If you want to filter out these merged submissions when you want to view the log, you can use the following command:
Git log-oneline-no-merges
3. Rewrite the last commit message
If the commit information is poorly written or there are typos in your most recent submission, you can modify it with the following command:
Git commit-v-- amend
The-v here is optional and can mention some additional information to help you describe commit message
4. Clear all untracked changes
First, let's explain a concept:
If you create a new file that did not previously exist in the git history, then the file is an untracked change. To track this file, you need to submit it to git.
If you use git checkout. All changes that have been tracked are cleared. Use the following command to clear all untracked changes:
Git clean-f-d
5. Print a visual log
Use the following command to print out a visual log
Git log-pretty=oneline-graph-decorate-all
(translator's note: OK, it still can't be compared with sourcetree)
6. Query Git for changelog
This command can query Git about who has made what changes between two commit, which looks like a changelog.
Git shortlog.. HEAD
By filling in the hash value of commit above, you can find out the change between the commit and HEAD, where.. The following HEAD can also be omitted
You can also use git shortlog HEAD~20.. Take the records of the last 20 commit
7. Query the log for a specified date
You may need to query the git log between two days, when you can use the git log command with-- since and-- util identifiers
If you want to check the logs between February 10, 2016 and February 19, 2016, you can run:
Git log-since='FEB 10 2016'-until='FEB 19 2016'
8. List all git aliases
Sometimes you may forget the git aliases you set up before. the following command is not a function of git, but it can help you find all the git aliases.
Git config-l | grep alias | sed's / ^ alias\. / / g'
9. Query the commits containing a keyword
If you know exactly what the code you are looking for is written, or if you know a particular keyword, you can use it to search.
Git log-S "config.menu_items"
In this example, all submissions containing config.menu_items will be found.
10. Ultimate skill
Git help-g
You can see a list of git tutorials similar to the following. Through git help, you can open the specified tutorials page in the browser. The column on the left is the name.
The common Git guides are: attributes defines attributes of Git paths everyday every day learn some useful Git commands glossary a Git vocabulary ignore specify Git ignore file modules definition Git sub-module revisions specify Git revision and scope tutorial Git tutorial introduction (for version 1.5.1 or newer) workflows a recommended Git workflow overview thank you for reading this article carefully I hope the article "how to improve the development efficiency of Git" shared by the editor is helpful to everyone. At the same time, I also hope that you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.