• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            流量統(tǒng)計:
            Rixu Blog (日需博客)
            日需博客,每日必需來踩踩哦..
            posts - 108,comments - 54,trackbacks - 0

            CONFIGURE

            • 標(biāo)識你自己:電子郵件和名字:
            1
                         2
                         3
                         
            git config --global user.name "David Beckwith"
                         
                         git config --global user.email "dbitsolutions@gmail.com"
            • 看所有用戶:
            
                         
            git config --list

            或者

            
                         
            cat .gitconfig
            • 設(shè)置別名 *
            
                         
            git config --global alias.co checkout
            • 查看你的配置 *
            
                         
            cat .gitconfig
            • 去忽略空白 (Ruby is whitespace insensitive)
            
                         
            git config --global apply.whitespace nowarn
            • Some nice aliases:
            1
                         2
                         3
                         4
                         5
                         6
                         7
                         
            gb = git branch
                         gba = git branch -a
                         gc = git commit -v
                         gd = git diff | mate
                         gl = git pull
                         gp = git push
                         gst = git status
            • START USING GIT *
            
                         
            git init
            • TO IGNORE SOME FILES *

            在根目錄下增加一個叫 .gitignore 的文件,并且增加你想ignore的文件:

            1
                         2
                         3
                         
            *.log
                         db/schema.rb
                         db/schema.sql

            Git自動ignore空目錄。如果你想包含log目錄,但是想ignore里面的所有文件,首先在.gitignore文件里加log/* , 然后在這個空目錄下再添加一個空的 .gitignore 文件。

            
                         
            touch log/.gitignore
            • add新文件以及所有change到git index *
            
                         
            git add .
            • 看狀態(tài) *
            
                         
            git status
            • 提交 *
            
                         
            git commit -m "First import"
            • 看已經(jīng)被提交的 *
            
                         
            git ls-files
            • 刪除一個文件 *
            
                         
            git rm [file name]
            • 提交當(dāng)前repos的所有的改變 *
            
                         
            git commit -a
            • 添加一個文件到git index *
            
                         
            git add [file name]
            • 當(dāng)你用-v參數(shù)的時候可以看commit的差異 *
            
                         
            git commit -v
            • 添加commit信息 *
            
                         
            git commit -m "This is the message describing the commit"
            • -a是代表add,把所有的change加到git index里然后再commit *
            
                         
            git commit -a
            • 一般提交命令: *
            
                         
            git commit -a -v
            • 看你commit的日志 *
            
                         
            git log
            • TO VIEW A LOG OF YOUR COMMITS WITH A GRAPH TO SHOW THE EXTENT OF THE CHANGES *
            
                         
            git log --stat
            • TO HAVE PAGINATION WHEN VIEWING THE LOG FILE USE THE -v OPTION *
            
                         
            git log -v
            • TO VISUALIZE YOUR CHANGES *
            
                         
            gitk --all
            • TO CREATE A NEW BRANCH *
            
                         
            git branch [name of your new branch]
            • TO VIEW ALL OF THE EXISTING BRANCHES *
            
                         
            git branch
            • TO VIEW A LIST OF ALL BRANCHES *
            
                         
            git branch -a
            • TO SWITCH TO ANOTHER BRANCH *

            The state of your file system will change after executing this command.

            
                         
            git checkout [name of the branch you want to switch to]

            OR

            
                         
            git co [name of the branch you want to switch to]
            • TO MAKE SURE THAT YOUR NEW BRANCH GETS CHANGES FROM THE MASTER BRANCH (WHERE EVERYBODY ELSE IS WORKINGUSE THE REBASE COMMAND*
            
                         
            git rebase master
            • TO MERGE YOUR NEW BRANCH INTO THE MASTER BRANCH *

            First, switch back to the master branch:

            
                         
            git co master

            Check to see what changes you’re about to merge together, compare the two branches:

            
                         
            git diff master xyz

            If you’re in a branch that’s not the xyz branch and want to merge the xyz branch into it:

            
                         
            git merge xyz
            • TO REVERT YOUR CHANGES to before the merge. *
            
                         
            git reset --hard ORIG_HEAD
            • TO RESOLVE CONFLICTS just edit your file. *

            Remove the markings, add the file, then commit.

            • TO CREATE A BRANCH AND SWITCH TO THE BRANCH IN ONE MOVE: *
            
                         
            git checkout -b [name of new branch]
            • TO CREATE A “CLIPBOARD” or “STASH” OF CHANGES THAT ARE NOT YET COMMITED (SO THAT YOU CAN SWITCH TO ANOTHER BRANCH IN THE MIDDLE OFYOUR CHANGES.), CREATE A STASH.*
            
                         
            git stash "Put a message here to remind you of what you're saving to the clipboard"
            • TO SWITCH AWAY FROM THE CURRENT BRANCH *
            
                         
            git co [branch you want to switch to]
            • Do whatever Then switch back to the stashed branch *
            
                         
            git co [the stashed branch]
            • TO VIEW THE LIST OF STASHES *
            
                         
            git stash list
            • TO LOAD BACK THE “CLIPBOARD” OR “STASH” *
            
                         
            git stash apply

            Now you can continue to work where you were previously.

            • TO DELETE A BRANCH THAT IS NOT USED ANYMORE, but already merged into the current branch. (TO CLEAN UP)*
            
                         
            git branch -d [name of branch you want to delete]
            • TO DELETE AN UNMERGED BRANCH *
            
                         
            git branch -D [name of branch you want to delete]
            • TO DELETE THE STASH. (ERASE THE “CLIPBOARD” FROM MEMORY)*
            
                         
            git stash clear
            • TO SET UP YOUR REPOSITORY FOR SHARING ON A CENTRAL SERVER *

            Copy up your repository. e.g.:

            
                         
            scp -r my_project deploy@yourbox.com:my_project

            Move your files on the remote server to /var/git/my_project For security make the owner of this project git On the repository server:

            
                         
            sudo chown -R git:git my_project

            Then (for security) restrict the “deploy” user to doing git-related things in /etc/passwd with a git-shell.

            • TO CHECK OUT THE GIT REPOSITORY TO YOUR LOCALHOST. ON YOUR LOCAL HOST DO THIS:*
            
                         
            git clone git@yourbox.com:/var/git/my_project
            • TO SEE SOME INFO ABOUT THE REPOSITORY THAT WILL TELL YOU WHICH REPOSITORY IS THE MASTER AND WHICH IS THE SLAVE:*
            
                         
            cat .git/config

            By virtue of having cloned the remote repository, your local repository becomes the slave and will track and synchronize with the remote master branch.

            • TO UPDATE YOUR LOCAL BRANCH FROM THE REMOTE SERVER: *
            
                         
            git pull
            • TO GET A COPY OF THE ENTIRE REMOTE REPOSITORY (e.g. a repository named “laptop”) WITHOUT MERGING THEM INTO YOUR LOCAL BRANCHES USEFETCH*
            
                         
            git fetch laptop
            • TO MERGE TWO LOCAL BRANCHES (ie. your local xyz branch with your local master branch) USE MERGE *
            
                         
            git merge laptop/xyz

            This merged the (already copied laptop repository’s xyz branch) with the current branch you’re sitting in.

            • TO MERGE THE REMOTE BRANCH WITH YOUR LOCAL BRANCH THAT YOU ARE SITTING IN USE PULL
              TO ADD LOCAL KNOWLEDGE (TO YOUR LOCAL REPOSITORY) OF A 2ND REMOTE REPOSITORYLIKE YOUR LAPTOP*
            
                         
            git remote add laptop duo2book.local:repos/m_project

            where ’’‘laptop’’” is the name of the remote repository and ”’‘duo2book.local’’” is the name of the remote machine.

            • TO VIEW META INFORMATION ABOUT THAT REMOTE REPOSITORY *
            
                         
            git remote show laptop
            • TO PUSH A COMMITTED LOCAL CHANGE OF THE xyz BRANCH TO THE REMOTE laptop BRANCH *
            
                         
            git push laptop xyz

            *TO CREATE A TRACKING BRANCH (A SLAVE BRANCH). * Ie. to link a local branch to a remote branch:

            
                         
            git branch --track local_branch remote_branch
            • NOW IF YOU’RE SITTING IN THE LOCAL TRACKING BRANCH, TO PULL YOU DON’T NEED TO SPECIFY THE REMOTE TRACKING BRANCH:*
            
                         
            git pull

            Note: You can track(link) different local branches to different remote machines. For example, you can track your friend’s “upgrade” branch with your “bobs_upgrade” branch, and simultaneously you can track the origin’s “master” branch (of your main webserver) with your local “master” branch.

            By convention, ‘origin’ is the local name given to the remote centralized server which is the way SVN is usually set up on a remote server.

            • TO SEE WHICH LOCAL BRANCHES ARE TRACKING A REMOTE BRANCH:*
            
                         
            git remote show origin

            TO WORK WITH AN SVN REPOSITORY BUT WORK WITH GIT LOCALLY:

            
                         
            git-svn clone [http location of an svn repository]

            Now you can work with the checked out directory as though it was a git repository. (cuz it is)
            TO PUSH (COMMITCHANGES TO THE REMOTE SERVER

            
                         
            git-svn dcommit
            • TO UPDATE YOUR LOCAL REPOSITORY FROM THE SVN REPOSITORY*
            
                         
            git-svn rebase

            NOTE: make sure you have your perl bindings to your local svn installation.
            I screwed up, how do I reset my checkout?

            
                         
            git checkout -f
            Logo
            作者:Gezidan
            出處:http://www.rixu.net    
            本文版權(quán)歸作者和博客園共有,歡迎轉(zhuǎn)載,但未經(jīng)作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接,否則保留追究法律責(zé)任的權(quán)利。
            posted on 2011-08-11 11:43 日需博客 閱讀(726) 評論(0)  編輯 收藏 引用 所屬分類: 技術(shù)文章未分類
            亚洲国产小视频精品久久久三级| 精品久久无码中文字幕| 久久涩综合| 日产精品久久久久久久性色| 久久美女网站免费| 97精品伊人久久久大香线蕉 | 大伊人青草狠狠久久| 国产91久久综合| 久久综合给久久狠狠97色| 久久人人爽人人爽人人片AV东京热| 亚洲va中文字幕无码久久 | 伊人久久精品影院| 999久久久免费国产精品播放| 久久久久免费精品国产| 丁香五月综合久久激情| 久久国产乱子精品免费女| 久久夜色精品国产网站| 2021国产精品午夜久久| 久久人人爽人人爽AV片| 国产亚洲成人久久| 麻豆精品久久精品色综合| 久久精品午夜一区二区福利| 国内精品综合久久久40p| 久久久久亚洲AV无码专区网站 | 国产激情久久久久久熟女老人| 国产免费福利体检区久久| 7国产欧美日韩综合天堂中文久久久久 | 中文成人无码精品久久久不卡 | 国产亚州精品女人久久久久久| 久久精品a亚洲国产v高清不卡| 国产精品99久久久精品无码| 久久久黄片| 一级a性色生活片久久无| 婷婷国产天堂久久综合五月| 一本色综合久久| 亚洲熟妇无码另类久久久| 亚洲国产精品一区二区久久hs| 久久无码人妻一区二区三区午夜| 久久久噜噜噜久久熟女AA片| 国产综合久久久久| 精品久久国产一区二区三区香蕉|