Git everyday use Notes

Create a git repository

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

Creating a branch

git branch newbranch # create a branch in the local
 git checkout newbranch # to switch to the new branch
 git push origin newbranch # new branch will submit to the distal
 git branch -d newbranch # delete the local branch
 git psuh origin: newbranch # delete remote branch, on behalf of the colon before branching deleted

Operation remote branch

git branch -a # see which remote branch there
 git branch -a # see which remote branch there, and it displays the last commit information
 git push origin --delete [remote branch name] # delete the specified remote branch

Version rollback

git log # commit log display, showing not so pretty
 git log --pretty = oneline # view the commit log, showing in a row, more beautiful
 git reset --hard [commit id] # View Submitted by git log history to determine if you want to return to the location, and want to get back to the execution of the commit id
 reflog git # View all git command can be used to look before the rollback commit id in use git reset --hard roll back the past

 

Reproduced in: https: //my.oschina.net/u/3398936/blog/1615916

Intelligent Recommendation

Python everyday use record

Sort sorted python sorting functions sort, sorted list application Detailed dictionary and sorting and ordering example, a built-in list python a very useful sorting function sort, sorted, it can be u...

go everyday use summary

Foreword Unconsciously entry also has a month, and gradually accustomed to the use of go-language development, also encountered some problems using it as a monthly summary of good. to sum up 1. sql Re...

SQL-- everyday use 2

1、Limit   SELECT * from leader LIMIT 2; 2, like the wildcard slightly 3, in IN operator allows you to specify the plurality of values ​​in the WHERE clause. SELECT * from leader WHERE phone IN('1...

Laravel everyday use summary

Field as a key key CollectionkeyBy()Method details:Here stamp Creating model classes and database migration file Create a controller and based approach Subqueries1.     laravel Code 2 sub-qu...

MySQL manual for everyday use

View table structure Documentation View table index Overview View details field Perform a detailed analysis of SQL performance bottlenecks SQL Concurrent stress test Slow SQL Log Reproduced in: https:...

More Recommendation

Master the everyday use of ubuntu

ubuntu daily use git command: ubuntu common commands Compression packing related commands...

Golang everyday enum use

In mathematics and computer science theories, a collectionenumerateIt is a program that lists all members with poor sequences, or a count of a specific type of object. Eprusts are more commonly used i...

[Git notes] git use notes

contents First, pull the warehouse code, submit the code Second, new, switch branch First, pull the warehouse code, submit the code 1, pull the git project. 2, submit the code process Step1. View the ...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top