Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common commands in Git?

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will introduce to you what are the common commands of Git. The content of the article is good. Now I would like to share it with you. Friends who feel in need can understand it. I hope it will be helpful to you. Let's read it along with the editor's ideas.

Git is the most advanced distributed version control system in the world, which we often use when developing, so here we sort out some commonly used git commands.

Create a new git repository

Git init # initialize git add readme.md # add a new file git commit-am "some description" git remote add origin [remote address] # add remote warehouse address git push-u origin master # submit to remote

Create a branch in the new warehouse

Git branch newbranch # create a branch locally git checkout newbranch # switch to a new branch git push origin newbranch # submit the new branch to the remote git branch-d newbranch # delete the local branch git psuh origin: newbranch # delete the remote branch, the colon before the branch indicates deletion

Operate remote branch

Git branch-a # look at the remote branches git branch-a # see what the remote branches are, and display the last commit information git push origin-- delete [remote branch name] # Delete the specified remote branch

Version fallback

Git log # shows the submission log, shows less beautiful git log-- pretty=oneline # View the submission log, shows on one line, more beautiful git reset-- hard [commit id] # View the submission history through git log to determine where to go back And get the git reflog # that you want to return to the commit id execution to see all the executed git commands can be used to find the commit id before rollback using git reset-- hard rollback past these are all the specific contents of Git common commands, and more related to Git common commands can be searched for previous articles or browse the following articles to learn ha! I believe the editor will add more knowledge to you. I hope you can support it!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report