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 Git commands should every programmer know?

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article focuses on "what Git commands every programmer should know". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what Git commands every programmer should know.

1. Initialize the local Git repository

Git init

2. Create a local copy of the remote repository

Git clone ssh://git@github.com/ [username] / [repository-name]. Git

3. Check the status

Git status

4. Add files to the staging area

Git add [file-name.txt]

5. Add all new and changed files to the staging area

Git add-A

6. Commit changes

Git commit-m "[commit message]"

7. Delete files (or folders)

Git rm-r [file-name.txt]

8. List branches (an asterisk indicates the current branch)

Git branch

9. Create a new branch

Git branch [branch name]

10. Delete a branch

Git branch-d [branch name]

Create a new branch and switch to it

Git checkout-b [branch name]

12. Clone a remote branch and switch to it

Git checkout-b [branch name] origin/ [branch name]

13. Rename the local branch

Git branch-m [old branch name] [new branch name]

14. Switch to branch

Git checkout [branch name]

15. Merge a branch into an active branch

Git merge [branch name]

16. Merge a branch into a target branch

Git merge [source branch] [target branch]

17. Store changes in an inappropriate working directory

Git stash

18. Delete all hidden entries

Git stash clear

19. Push the branch to your remote repository

Git push origin [branch name]

20. Push changes to the remote repository

Git push

21. Update the local repository to the latest submission

Git pull

22. Extract changes from the remote repository

Git pull origin [branch name]

23. Add a remote repository

Git remote add origin ssh://git@github.com/ [username] / [repository-name]. Git

24. View changes

Git log

25. Preview changes before merging

Git diff [source branch] [target branch] so far, I believe you have a deeper understanding of "what Git commands every programmer should know". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue 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.

Share To

Development

Wechat

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

12
Report