In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the use of Git in linux, 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.
Navigation-skip to previous branch git checkout-View history # each commit displays git log on one line-- oneline # searches all commit logs for git log containing "homepage"-- all-- grep='homepage' # to get someone's submission log git log-- author= "Maxence" oops: you reset a submission that you didn't want to keep, but now you want to roll back? # get all operation history git reflog # reset to the corresponding submission git reset HEAD@ {4} #. Or. Git reset-- hard ouch: I've made a mess of the local warehouse. How should I clean it up? Git fetch origin git checkout master git reset-hard origin/master view the different git diff master..my-branch customizations of my branch and master # edit the last commit git commit-- amend-m "better commit log" # attach something to the last commit and keep the commit log unchanged git add. & & git commit-- amend-- no-edit # empty submission-can be used to re-trigger CI to build git commit-- allow-empty-m "chore: re-trigger build"
Squash submission
For example, I want the last three rebase submissions:
-git rebase-I HEAD~3
-keep the pick of the first line, and replace the remaining submissions with squash or s
-Clean up the submission log and save it (type: wq in the vi editor)
Pick 64d26a1 feat: add index.js s 45f0259 fix: update index.js s 8b15b0a fix: typo in index.js correction
For example, I want to add something to the submission of fed14a4c.
Git submit Branch
Git add. Git commit-- fixup HEAD~1 # or you can replace HEAD~1 git rebase-I HEAD~3-- autosquash # with the submitted hash value (fed14a4c). Execute the command on each submission when you save and exit the file (enter `: wq` in VI) rebase
If there are many features, there may be multiple commits in a branch. If the test fails, you want to find the commit that caused the test to fail. At this point you can use the rebase-- exec command to execute the command on each submission.
# run the `npm test` command git rebase HEAD~3-- exec "npm test" on the last 3 submissions
Temporary storage
Temporary storage is not just git stash and git stash pop;)
# Save all files being tracked git stash save "log information" # list all temporary entries git stash list # get and delete temporary entries git stash apply stash@ {1} git stash drop stash@ {1} #... Or use a command. Git stash pop stash@ {1} cleanup # remove branches that do not exist on the remote warehouse git fetch-p # remove all branches containing `greenkeeper` git fetch-p & & git branch-- remote | fgrep greenkeeper | sed's / ^.\ {9\} / /'| xargs git push origin-- deleteGitHub = Git + Hub
I use Hub as an encapsulation of git. If you want to do the same, you can set up an alias: alias git='hub'
# Open a browser to access the repository url (GitHub warehouse only) git browse
Bonus: my favorite git alias
Alias gendarmergit` alias glog='git log-- oneline-- decorate-- graph' alias gst='git status' alias gp='git push' alias ga='git add'alias gc='git commit-v' # alias yolo='git push-- force' # use git-standup () {AUTHOR=$ {AUTHOR:= "`git config user.name`"} since=yesterday if [[$(date +% u) = = 1]] when reporting work every week Then since= "2 days ago" fi git log-- all-- since "$since"-- oneline-- author= "$AUTHOR"} Thank you for reading this article carefully. I hope the article "what's the use of Git in linux" shared by the editor will be helpful to you. At the same time, I hope you will support us, pay attention to the industry information channel, and 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.