The best git starter tutorial ever seen

Source: Internet
Author: User
Tags commit diff

Find the best git starter tutorial you've seen today

http://lostechies.com/joshuaflanagan/2010/09/03/use-gitk-to-understand-git/

Paste some commands

1. Git add to add files to staged area.
2. Git commit commits staged file, and there are several options that are important:-a skips over staged area, commits directly, and the file name behind it skips the stage and commits directly. However, if the file is already in index, the new file will not be added automatically.
3.git Status View git diff is more detailed from the last commit to the current change, but it only contains changes that should be included in the staged area but not yet included, and Git diff--staged is listed from the last commit to staged Area changes.
4.. gitignore file can be set which files are excluded, usually can be set. O,. A and other files.
5. Git rm is used to remove files.
6. Git mv can be used to rename files.
7. Git log is used to view the log, git log-p view in detail, GITK is a graphical viewing tool.
8.Unstaging a staged file can be used with git reset HEAD <file>. Unmodifying a Modified file can be checkout with git--<file>. Git commit--amend is used to cancel the last commit.
9. Git remote displays all remote (plus-v display details). git remote add [shortname] [url] is used to add remote. git fetch [remote-name] will only pull down all the changes, but will not automatically merge, but git pull will automatically merge. git remote show [remote-name] can see a remote details. Git remote rename is used to change the name of a remote. GIT remote RM deletes a remote.
10.git tag Lists all the tags. Git show tag-name can view tag details. git tag [-a] tag-name-m message [commit-checksum] If you have a-a, add a annotated tag, if you do not have a, add a lightweight tag, If you want to add a tag after a commit, put checksum in the back. Git push has an option--tags will push up the tags message.

Git branch Testing add a testing branch. Git checkout testing switch to testing branch.
12. When switching branch, the current branch cannot have the uncommitted changes to switch past branch conflicts.
git merge branch-name branch-name merge to current branch. If there is a conflict, you can use status to view the state, after resolving conflict with add to notify Git has been resolved. And then commit the merge with commit.
Git branch-d branch-name, but this branch has to be completely merge into the head. If the option is-D, it doesn't matter what the merge status is.
A. Git branch--merged only shows the branch,--no-merged that are completely included in the head only show branch that are not fully contained by the head.
A. Git push (remote) (branch) push a local branch to remote. git push (remote) (local-branch-name):(remote-branch-name) can push local branch to remote branch.
17.git fetch downloaded branch can not edit, you must manually merge to the local branch after the edit. The $ git checkout-b local-branch-name remote-name/remote-branch-name can download the branch on the server and edit it directly.
Tracking branches It is not necessary to add remote parameters to the pull and push behind. Git branch-r lists the remote tracking branches.
git push [remotename]: [remote-branch] Remove a remote branch.
Rebase can get the same effect as merge, but the log record is better because it doesn't look like a branch. git rebase--onto newbase upstream branch will upstream the changes from branch to rebase. Git rebase basebranch topicbranch will topicbranch rebase to Basebranch.
21st.Do not rebase commits, which has pushed to a public repository.

22.git fetch by default gets the progress of all branch repo, unless you specify which branch. Git push can push a branch to repo.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.