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 Git commands?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces the knowledge of "what are the commonly used Git commands?" in the operation of actual cases, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Enough for daily use, even a little too much. Git remote add release http://{path}/{repository}.gitGit stash-hide some updates that don't want to commits

Git stash

Git checkout

...

Git checkout

Git stash pop

How to get a remote branch?

Git checkout feature/image-split

Git pull origin feature/image-split

How to commit code: from local-dev-branch to target-branch

Step1-commit to local-dev-branch

Comments format: [CHIN-195]-XXX

Step2-git checkout target-branch

Git pull

Git merge local-dev-branch

Step3-git push origin feature/image-split

Don't need to input username and password each time

Git config credential.helper store

After changed the password. Like: fatal: Authentication failed for

Git config-system-unset credential.helper

Then input your name and pwd

Git patch?

Git format-patch master-- stdout > fix_empty_poster.patch

Git patch

Git create a new branch and push it into remote

Git checkout-b [name of new branch]

Git push origin [name of new branch]

Ex: item-image

Git delete a branch

Git branch-D the_local_branch

Git push origin: the_local_branch

Git push origin-delete

Merge two branches

Feature/image-split-new

Goal: feature/item-image

1. Make sure the two branch is up-to-date

2. At feature/item-image, run 'git merge feature/image-split-new'

3. Resovle confilicts if has

4. Push origin feature/item-image

Git commit skip file

Http://stackoverflow.com/questions/7070659/git-exclude-ignore-files-from-commit

This will tell git you want to start ignoring the changes to the file

Git update-index-assume-unchanged path/to/file

When you want to start keeping track again

Git update-index-no-assume-unchanged path/to/file

Check out a remote branch in git

Git fetch origin

Git checkout groups

Http://makandracards.com/makandra/521-check-out-a-remote-branch-in-git

Git Reset-hard

Git reset-hard

Reset the staging area and the working directory to match the most recent commit.

Git Update comment in commit

Git rebase-I HEAD~3

'edit' in vim

Git commit-amend

Git rebase-continue

Git merge-squash or use "Git compare branch in Intellij"

Banch: master

Your branch: branch_sample

Create a new branch from master: for_review

Then execute git merge branch_sample-squash

Git Prune origin

Git remote prune origin

Git list remote branch

Git ls-remote-heads origin

Git delete remote repository

Git remote rm origin

Git ignore

Git rm-r-cached {full file path}

Git refusing to merge unrelated histories

Git pull-allow-unrelated-histories

This is the end of the content of "what are the common Git commands?" Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Internet Technology

Wechat

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

12
Report