{"id":1660,"date":"2017-02-01T06:34:31","date_gmt":"2017-02-01T06:34:31","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=1660"},"modified":"2017-02-01T06:34:31","modified_gmt":"2017-02-01T06:34:31","slug":"git-and-git-cola-tutorial","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2017\/02\/01\/git-and-git-cola-tutorial\/","title":{"rendered":"Git and Git Cola Tutorial"},"content":{"rendered":"<p>GIT TUTORIAL<br \/>\nref: <a href=\"http:\/\/rogerdudler.github.io\/git-guide\/\">http:\/\/rogerdudler.github.io\/git-guide\/<\/a><br \/>\n1. Create a new repository<br \/>\ncreate a new directory, open it and perform a<br \/>\ngit init<br \/>\nto create a new git repository.<\/p>\n<p>2. checkout a repository<br \/>\ncreate a working copy of a local repository by running the command<br \/>\ngit clone \/path\/to\/repository<br \/>\ngit clone https:\/\/github.com\/balanced\/balanced-php.git<br \/>\nwhen using a remote server, your command will be<br \/>\ngit clone username@host:\/path\/to\/repository<br \/>\ngit clone advcha@yahoo.com:https:\/\/github.com\/balanced\/balanced-php.git<\/p>\n<p>3. workflow<br \/>\nyour local repository consists of three &#8220;trees&#8221; maintained by git. the first one is your &#8220;Working Directory&#8221; which holds the actual files. the second one is the &#8220;Index&#8221; which acts as a staging area and finally the &#8220;HEAD&#8221; which points to the last commit you&#8217;ve made.<\/p>\n<p>4. add &amp; commit<br \/>\nYou can propose changes (add it to the Index) using<br \/>\ngit add &lt;filename&gt;<br \/>\ngit add *<br \/>\nThis is the first step in the basic git workflow. To actually commit these changes use<br \/>\ngit commit -m &#8220;Commit message&#8221;<br \/>\nNow the file is committed to the HEAD, but not in your remote repository yet.<\/p>\n<p>5. pushing changes<br \/>\nYour changes are now in the &#8220;HEAD&#8221; of your local working copy. To send those changes to your remote repository, execute<br \/>\ngit push origin master<br \/>\nChange master to whatever branch you want to push your changes to.<\/p>\n<p>If you have not cloned an existing repository and want to connect your repository to a remote server, you need to add it with<br \/>\ngit remote add origin &lt;server&gt;<br \/>\nNow you are able to push your changes to the selected remote server<\/p>\n<p>6. branching<br \/>\nBranches are used to develop features isolated from each other. The master branch is the &#8220;default&#8221; branch when you create a repository. Use other branches for development and merge them back to the master branch upon completion.<\/p>\n<p>create a new branch named &#8220;feature_x&#8221; and switch to it using<br \/>\ngit checkout -b feature_x<br \/>\nswitch back to master<br \/>\ngit checkout master<br \/>\nand delete the branch again<br \/>\ngit branch -d feature_x<br \/>\na branch is not available to others unless you push the branch to your remote repository<br \/>\ngit push origin &lt;branch&gt;<\/p>\n<p>7. update &amp; merge<br \/>\nto update your local repository to the newest commit, execute<br \/>\ngit pull<br \/>\nin your working directory to fetch and merge remote changes.<br \/>\nto merge another branch into your active branch (e.g. master), use<br \/>\ngit merge &lt;branch&gt;<br \/>\nin both cases git tries to auto-merge changes. Unfortunately, this is not always possible and results in conflicts. You are responsible to merge those conflicts manually by editing the files shown by git. After changing, you need to mark them as merged with<br \/>\ngit add &lt;filename&gt;<br \/>\nbefore merging changes, you can also preview them by using<br \/>\ngit diff &lt;source_branch&gt; &lt;target_branch&gt;<\/p>\n<p>8. tagging<br \/>\nit&#8217;s recommended to create tags for software releases. this is a known concept, which also exists in SVN. You can create a new tag named 1.0.0 by executing<br \/>\ngit tag 1.0.0 1b2e1d63ff<br \/>\nthe 1b2e1d63ff stands for the first 10 characters of the commit id you want to reference with your tag. You can get the commit id by looking at the log<\/p>\n<p>9. log<br \/>\nin its simplest form, you can study repository history using..<br \/>\ngit log<br \/>\nYou can add a lot of parameters to make the log look like what you want. To see only the commits of a certain author:<br \/>\ngit log &#8211;author=bob<br \/>\nTo see a very compressed log where each commit is one line:<br \/>\ngit log &#8211;pretty=oneline<br \/>\nOr maybe you want to see an ASCII art tree of all the branches, decorated with the names of tags and branches:<br \/>\ngit log &#8211;graph &#8211;oneline &#8211;decorate &#8211;all<br \/>\nSee only which files have changed:<br \/>\ngit log &#8211;name-status<br \/>\nThese are just a few of the possible parameters you can use. For more, see<br \/>\ngit log &#8211;help<\/p>\n<p>10. replace local changes<br \/>\nIn case you did something wrong, which for sure never happens ;), you can replace local changes using the command<br \/>\ngit checkout &#8212; &lt;filename&gt;<br \/>\nthis replaces the changes in your working tree with the last content in HEAD. Changes already added to the index, as well as new files, will be kept.<\/p>\n<p>If you instead want to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it like this<br \/>\ngit fetch origin<br \/>\ngit reset &#8211;hard origin\/master<\/p>\n<p>11. useful hints<br \/>\nbuilt-in git GUI<br \/>\ngitk<br \/>\nuse colorful git output<br \/>\ngit config color.ui true<br \/>\nshow log on just one line per commit<br \/>\ngit config format.pretty oneline<br \/>\nuse interactive adding<br \/>\ngit add -i<\/p>\n<p>GIT COLA<br \/>\ntutorial: <a href=\"http:\/\/cerebrux.net\/2013\/02\/07\/github-git-cola-gui-step-by-step-management-of-your-code\/\">http:\/\/cerebrux.net\/2013\/02\/07\/github-git-cola-gui-step-by-step-management-of-your-code\/<\/a><br \/>\n1) Install Git Cola GUI through Software Center or through terminal:<br \/>\nsudo apt-get install git-cola<br \/>\n2) Copy the repository link from the website then Launch Git Cola and paste the link. In terminal, it\u2019s equivalent of<br \/>\ngit clone \/github\/repo\/link.git<br \/>\nOnce you launch the Git Cola click \u00abClone\u00bb and paste the link you have copied from Github<br \/>\nOnce you provided the link, select where to download the repository and click \u00abOpen\u00bb<br \/>\nThis is the main window. It\u2019s empty because we haven\u2019t changed any code<br \/>\n3) You can edit your preferences by clicking Edit menu were you can customize your settings like email, username, prepared editor etc. In terminal it\u2019s equivalent of:<br \/>\ngit config &#8211;global user.name &#8216;John Doe&#8217;<br \/>\ngit config &#8211;global user.email &#8216;johndoe@mail.com&#8217;<br \/>\nTo edit your preferences, click on \u00abEdit \u2013&gt; Preferences\u00bb<br \/>\n4) Now edit some files inside your local repository clone and the hit the refresh Rescan button on Git Cola. In terminal, it\u2019s equivalent of:<br \/>\ngit status<br \/>\nand<br \/>\ngit diff<br \/>\nOpen the file that you need to edit and start editing. Save and close the file<br \/>\n5) Now once you can hit Stage, Comment to add a message for the changes and the Commit these changes:<br \/>\nIn terminal, it\u2019s equivalent of<br \/>\ngit add filename<br \/>\ngit add README.md<br \/>\nand then<br \/>\ngit commit -m &#8216;Commit message&#8217;<br \/>\ngit commit -m &#8216;Update the README file for better description&#8217;<br \/>\nOR COMBINE ADD AND COMMIT LIKE THIS:<br \/>\ngit commit -a -m &#8216;Update the README file for better description&#8217;<br \/>\nClick Stage, add some comment and then commit<br \/>\n6) You can also Tag your changes to create versions of your repo by clicking Actions menu \u2013&gt; Create Tag<br \/>\nIn terminal, it\u2019s equivalent of<br \/>\ngit tag -a v4.5.6 -m &#8216;my version 4.5.6&#8217;<br \/>\nCreate tag by clicking \u00abActions \u2013&gt; Add Tag\u00bb<br \/>\n7) Now you can upload (push) your changes and versions (tags) to your GitHub account.<br \/>\nIn terminal, it\u2019s equivalent of<br \/>\ngit push origin master<br \/>\nand your tag with<br \/>\ngit push origin v1.0.4<br \/>\nClick on \u00abPush\u00bb on the main window, check that \u00abInclude tags\u00bb is activated and then click Push<br \/>\nProvide your Username and Password of your Github account<br \/>\nCheck the commands tab to see the background messages<br \/>\n8) Now you can go to your Github page to see your changes and your tags<br \/>\nRefresh the GitHub page to see your comment and the commit history<\/p>\n<p>I WANT TO UPDATE MY LOCAL REPOSITORY:<br \/>\nref:http:\/\/stackoverflow.com\/questions\/1443210\/updating-a-local-repository-with-changes-from-a-github-repository<br \/>\nteddy@teddy-K43SJ:~\/Documents\/java\/processing-java-client$ git pull origin master<br \/>\nUsername for &#8216;https:\/\/github.com&#8217;: advcha<br \/>\nPassword for &#8216;https:\/\/advcha@github.com&#8217;:<br \/>\nFrom https:\/\/github.com\/finix-payments\/processing-java-client<br \/>\n* branch\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 master\u00a0\u00a0\u00a0\u00a0 -&gt; FETCH_HEAD<br \/>\nUpdating 79ff8fe..c52614a<br \/>\nerror: Your local changes to the following files would be overwritten by merge:<br \/>\nsrc\/main\/java\/com\/finix\/payments\/processing\/client\/Configuration.java<br \/>\nsrc\/main\/java\/com\/finix\/payments\/processing\/client\/model\/User.java<br \/>\nPlease, commit your changes or stash them before you can merge.<br \/>\nAborting<br \/>\nref:http:\/\/stackoverflow.com\/questions\/15745045\/how-do-i-resolve-git-saying-commit-your-changes-or-stash-them-before-you-can-me<br \/>\nhttps:\/\/git-scm.com\/book\/en\/v1\/Git-Tools-Stashing<br \/>\nso pls do:<br \/>\ngit stash<br \/>\nthen repeat:<br \/>\ngit pull origin master<\/p>\n<p>I ADDED A .gitignore FILE. I ALREADY ADD AND COMMIT THE FILE BUT THEN I GOT ERROR HERE WHEN TRYING TO PUSH A CHANGES:<br \/>\n! [rejected]\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 master -&gt; master (fetch first)<br \/>\nerror: failed to push some refs to &#8216;https:\/\/github.com\/advcha\/persuratan.git&#8217;<br \/>\nhint: Updates were rejected because the remote contains work that you do<br \/>\nhint: not have locally. This is usually caused by another repository pushing<br \/>\nhint: to the same ref. You may want to first integrate the remote changes<br \/>\nhint: (e.g., &#8216;git pull &#8230;&#8217;) before pushing again.<br \/>\nhint: See the &#8216;Note about fast-forwards&#8217; in &#8216;git push &#8211;help&#8217; for details.<br \/>\nSO ACTUALLY I DELETED A FEW FILES (WITH ~) ON THE REMOTE REPO. I NEED TO UPDATE MY LOCAL REPO FIRST<br \/>\ngit pull origin master<br \/>\nTHEN PUSH AGAIN<br \/>\ngit push origin master<\/p>\n<p>IF WE DONT WANT TO UPLOAD\/PUSH A FILE LIKE database.php<br \/>\n1. Create a new file .gitignore<br \/>\nhere is the content:<br \/>\napp\/config\/database.php<br \/>\n2. type: git commit -a -m &#8216;add .gitignore file&#8217;<br \/>\n3. type: git push OR git push origin master<\/p>\n<p>REMOTE, BRANCH, CHECKOUT<br \/>\n1. check our remote repo:<br \/>\ntype: git remote OR MORE DETAIL git remote -v<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git remote -v<br \/>\norigin\u00a0\u00a0 \u00a0https:\/\/github.com\/advcha\/persuratan.git (fetch)<br \/>\norigin\u00a0\u00a0 \u00a0https:\/\/github.com\/advcha\/persuratan.git (push)<\/p>\n<p>2. We can add a branch in the remote repo.<br \/>\non the remote repo website, just click the down arrow at Branch:master then type a branch we want like: addfeature<\/p>\n<p>3. in local repo, check our branch<br \/>\ngit branch<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git branch<br \/>\n* master<br \/>\nWE ONLY HAVE ONE BRANCH &#8216;master&#8217; YET<br \/>\n4. create a local repo:<br \/>\ngit branch addfeature<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git branch addfeature<br \/>\nTHEN check again:<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git branch<br \/>\naddfeature<br \/>\n* master<br \/>\n5. to switch to the new local repo:<br \/>\ngit checkout addfeature<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git checkout addfeature<br \/>\nSwitched to branch &#8216;addfeature&#8217;<br \/>\n6. make a change in index.html file (AYNTHING) then check status:<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git status<br \/>\nOn branch addfeature<br \/>\nChanges not staged for commit:<br \/>\n(use &#8220;git add &lt;file&gt;&#8230;&#8221; to update what will be committed)<br \/>\n(use &#8220;git checkout &#8212; &lt;file&gt;&#8230;&#8221; to discard changes in working directory)<\/p>\n<p>modified:\u00a0\u00a0 index.html<\/p>\n<p>no changes added to commit (use &#8220;git add&#8221; and\/or &#8220;git commit -a&#8221;)<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git commit -a -m &#8216;change index.php test&#8217;<br \/>\n[addfeature fc28a68] change index.php test<br \/>\n1 file changed, 103 insertions(+), 102 deletions(-)<br \/>\nrewrite index.html (97%)<br \/>\n7. commit the changes<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git commit -a -m &#8216;change index.php test&#8217;<br \/>\n[addfeature fc28a68] change index.php test<br \/>\n1 file changed, 103 insertions(+), 102 deletions(-)<br \/>\nrewrite index.html (97%)<br \/>\n8. then push to the remote repo (branch &#8216;addfeature&#8217;)<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git push addfeature<br \/>\n9. Check the remote repo<br \/>\nindex.html in master branch not affected ONLY in addfeature branch<br \/>\n10. merge the branch to master(NOT WORKING!!!)<br \/>\ngit merge master<br \/>\ngit checkout master<br \/>\ngit push<br \/>\nOK THIS HAS TO BE DONE IN github PAGE. FIRST CLICK &#8216;New Pull Request&#8217;<br \/>\n11. Click &#8216;Create Pull Request&#8217; &#8230; THEN WE CAN MERGE IT<br \/>\nAT LAST WE CAN DELETE THE &#8216;addfeature&#8217; BRANCH BECAUSE ITS ALREADY MERGED TO &#8216;master&#8217; BRANCH!<br \/>\nWE CAN ALSO DELETE THE REMOTE BRANCH FROM TERMINAL WITH git push origin :addfeature (BE CAREFULL!!!)<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git push origin :addfeature<br \/>\nUsername for &#8216;https:\/\/github.com&#8217;: advcha<br \/>\nPassword for &#8216;https:\/\/advcha@github.com&#8217;:<br \/>\nerror: unable to delete &#8216;addfeature&#8217;: remote ref does not exist<br \/>\nerror: failed to push some refs to &#8216;https:\/\/github.com\/advcha\/persuratan.git&#8217;<br \/>\nref:http:\/\/makandracards.com\/makandra\/621-git-delete-a-branch-local-or-remote<br \/>\nhttp:\/\/stackoverflow.com\/questions\/2003505\/delete-a-git-branch-both-locally-and-remotely<br \/>\n12. NOW WE NEED TO MERGE IT ALSO IN OUR LOCAL REPO<br \/>\ntype: git checkout master<br \/>\nthen: git pull<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git checkout master<br \/>\nAlready on &#8216;master&#8217;<br \/>\nYour branch is up-to-date with &#8216;origin\/master&#8217;.<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git pull<br \/>\nremote: Counting objects: 1, done.<br \/>\nremote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0<br \/>\nUnpacking objects: 100% (1\/1), done.<br \/>\nFrom https:\/\/github.com\/advcha\/persuratan<br \/>\n1d338b5..7cc859e\u00a0 master\u00a0\u00a0\u00a0\u00a0 -&gt; origin\/master<br \/>\nUpdating 1d338b5..7cc859e<br \/>\nFast-forward<br \/>\nindex.html | 187 +++++++++++++++++++++++++++++++&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n1 file changed, 94 insertions(+), 93 deletions(-)<br \/>\n13. DELETE LOCAL BRANCH &#8216;addfeature&#8217; (ref:http:\/\/makandracards.com\/makandra\/621-git-delete-a-branch-local-or-remote)<br \/>\ntype: git branch -d addfeature<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git branch -d addfeature<br \/>\nDeleted branch addfeature (was fc28a68).<br \/>\n14. Check the branch again<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git branch<br \/>\n* master<br \/>\n15. SYNCHRONIZED THE BRANCHES (REMOTE &amp; LOCAL)<br \/>\nteddy@teddy-K43SJ:~\/Documents\/works\/persuratan$ git fetch -p<br \/>\nFrom https:\/\/github.com\/advcha\/persuratan<br \/>\nx [deleted]\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (none)\u00a0\u00a0\u00a0\u00a0 -&gt; origin\/addfeature<\/p>\n<p>MERGE TWO REPOSITORIES<br \/>\nre:http:\/\/saintgimp.org\/2013\/01\/22\/merging-two-git-repositories-into-one-repository-without-losing-file-history\/<br \/>\nhttp:\/\/stackoverflow.com\/questions\/1425892\/how-do-you-merge-two-git-repositories<\/p>\n<p>REAL WORLD SAMPLE DEVELOPMENT WITH GITHUB:http:\/\/nvie.com\/posts\/a-successful-git-branching-model\/<\/p>\n<p>WORKING SAMPLE FROM SCRATCH<br \/>\n1. Create a new repository in my github account: OpenCV-python (https:\/\/github.com\/advcha\/OpenCV-Python.git)<br \/>\n2. in my terminal, clone it into \/media\/data\/MASTER\/opencv\/<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv$ git clone https:\/\/github.com\/advcha\/OpenCV-Python.git<br \/>\nCloning into &#8216;OpenCV-Python&#8217;&#8230;<br \/>\nremote: Counting objects: 3, done.<br \/>\nremote: Compressing objects: 100% (2\/2), done.<br \/>\nremote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0<br \/>\nUnpacking objects: 100% (3\/3), done.<br \/>\nChecking connectivity&#8230; done.<br \/>\n3. Add some files and directories in it like images\/ and opencv_read_write.py (I copied them from \/home\/teddy\/opencv\/samples\/python\/) OR SEARCH THE FILENAME IN \/media\/data\/MASTER\/opencv\/opencv_python_tutorial.txt<br \/>\n4. check the un-uploaded file and dir with &#8216;git status&#8217;:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git status<br \/>\nOn branch master<br \/>\nYour branch is up-to-date with &#8216;origin\/master&#8217;.<\/p>\n<p>Untracked files:<br \/>\n(use &#8220;git add &lt;file&gt;&#8230;&#8221; to include in what will be committed)<\/p>\n<p>images\/<br \/>\nopencv_read_write.py<\/p>\n<p>nothing added to commit but untracked files present (use &#8220;git add&#8221; to track)<br \/>\n5. Add the file and the dir to prepare for uploading with &#8216;git add *&#8217;:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git add *<\/p>\n<p>6. Commit the file and dir and give it a tag &#8216;upload some python scripts&#8217;:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git commit -a -m &#8216;upload some python scripts&#8217;<br \/>\n[master 46abb81] upload some python scripts<br \/>\n28 files changed, 17 insertions(+)<br \/>\ncreate mode 100644 images\/Temperate 09 &#8211; Small.png<br \/>\ncreate mode 100644 images\/Temperate 09 &#8211; Small_clean.png<br \/>\ncreate mode 100644 images\/approx.jpg<br \/>\ncreate mode 100644 images\/bolt.png<br \/>\ncreate mode 100644 images\/clahe.jpg<br \/>\ncreate mode 100644 images\/dave.jpg<br \/>\ncreate mode 100644 images\/dave.png<br \/>\ncreate mode 100644 images\/fruits.jpg<br \/>\ncreate mode 100644 images\/fruits_gray.jpg<br \/>\ncreate mode 100644 images\/grass.png<br \/>\ncreate mode 100644 images\/hand.jpg<br \/>\ncreate mode 100644 images\/john_dory-zeus_faber.jpg<br \/>\ncreate mode 100644 images\/mario.jpg<br \/>\ncreate mode 100644 images\/mario_coin.png<br \/>\ncreate mode 100644 images\/mario_coin1.png<br \/>\ncreate mode 100644 images\/messi5.jpg<br \/>\ncreate mode 100644 images\/messi_face.jpg<br \/>\ncreate mode 100644 images\/more_coins.png<br \/>\ncreate mode 100644 images\/my_family.jpg<br \/>\ncreate mode 100644 images\/noisy2.png<br \/>\ncreate mode 100644 images\/opencv_logo.png<br \/>\ncreate mode 100644 images\/rect.jpg<br \/>\ncreate mode 100644 images\/shapes.png<br \/>\ncreate mode 100644 images\/star.jpg<br \/>\ncreate mode 100644 images\/star2.jpg<br \/>\ncreate mode 100644 images\/uss_arizona.jpg<br \/>\ncreate mode 100644 images\/water_coins.jpg<br \/>\ncreate mode 100644 opencv_read_write.py<\/p>\n<p>7. Push them to github account with &#8216;git push origin master&#8217;:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git push origin master<br \/>\nUsername for &#8216;https:\/\/github.com&#8217;: advcha<br \/>\nPassword for &#8216;https:\/\/advcha@github.com&#8217;:<br \/>\nCounting objects: 32, done.<br \/>\nDelta compression using up to 4 threads.<br \/>\nCompressing objects: 100% (31\/31), done.<br \/>\nWriting objects: 100% (31\/31), 5.93 MiB | 1.10 MiB\/s, done.<br \/>\nTotal 31 (delta 0), reused 0 (delta 0)<br \/>\nTo https:\/\/github.com\/advcha\/OpenCV-Python.git<br \/>\n330ef49..46abb81\u00a0 master -&gt; master<\/p>\n<p>8. Check again my local repo with &#8216;git status&#8217;:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git status<br \/>\nOn branch master<br \/>\nYour branch is up-to-date with &#8216;origin\/master&#8217;.<\/p>\n<p>nothing to commit, working directory clean<\/p>\n<p>OK DONE<\/p>\n<p>9. Add some python scripts from \/home\/teddy\/opencv\/samples\/python\/ (copy and paste them into \/media\/data\/MASTER\/opencv\/OpenCV-Python)<\/p>\n<p>10. check with &#8216;git status&#8217;:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git status<br \/>\nOn branch master<br \/>\nYour branch is up-to-date with &#8216;origin\/master&#8217;.<\/p>\n<p>Untracked files:<br \/>\n(use &#8220;git add &lt;file&gt;&#8230;&#8221; to include in what will be committed)<\/p>\n<p>drawing.py<br \/>\nmouse_draw.py<br \/>\nmouse_paint.py<br \/>\nmouse_paint_img.py<\/p>\n<p>nothing added to commit but untracked files present (use &#8220;git add&#8221; to track)<\/p>\n<p>11. add them with &#8216;git add *&#8217;:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git add *<\/p>\n<p>12. commit them:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git commit -a -m &#8216;Upload some python scripts&#8217;<br \/>\n[master 567e4fd] Upload some python scripts<br \/>\n4 files changed, 165 insertions(+)<br \/>\ncreate mode 100644 drawing.py<br \/>\ncreate mode 100644 mouse_draw.py<br \/>\ncreate mode 100644 mouse_paint.py<br \/>\ncreate mode 100644 mouse_paint_img.py<\/p>\n<p>13. The last, push them into my github account:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git push origin master<br \/>\nUsername for &#8216;https:\/\/github.com&#8217;: advcha<br \/>\nPassword for &#8216;https:\/\/advcha@github.com&#8217;:<br \/>\nCounting objects: 7, done.<br \/>\nDelta compression using up to 4 threads.<br \/>\nCompressing objects: 100% (6\/6), done.<br \/>\nWriting objects: 100% (6\/6), 2.66 KiB | 0 bytes\/s, done.<br \/>\nTotal 6 (delta 0), reused 0 (delta 0)<br \/>\nTo https:\/\/github.com\/advcha\/OpenCV-Python.git<br \/>\n46abb81..567e4fd\u00a0 master -&gt; master<\/p>\n<p>OK. DO IT OVER AND OVER AGAIN FOR THE OTHERS FILES AND DIRECTORIES!!!<\/p>\n<p>HOW TO UPDATE FILE AND UPDATE THE CHANGES TO REMOTE REPO?<br \/>\n1. Modify README.md to<br \/>\nSome python scripts for practising OpenCV. Use Python 2.7 (some scripts works for Python 3.4) and OpenCV 3.1.0.<br \/>\nSAVE THE MODIFICATION\u00a0\u00a0 (IT BETTER TO REMOVE THE TEMPORARY FILE LIKE README.md~)<br \/>\n2. check the status:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git status<br \/>\nOn branch master<br \/>\nYour branch is up-to-date with &#8216;origin\/master&#8217;.<\/p>\n<p>Changes not staged for commit:<br \/>\n(use &#8220;git add &lt;file&gt;&#8230;&#8221; to update what will be committed)<br \/>\n(use &#8220;git checkout &#8212; &lt;file&gt;&#8230;&#8221; to discard changes in working directory)<\/p>\n<p>modified:\u00a0\u00a0 README.md<\/p>\n<p>Untracked files:<br \/>\n(use &#8220;git add &lt;file&gt;&#8230;&#8221; to include in what will be committed)<\/p>\n<p>README.md~<\/p>\n<p>no changes added to commit (use &#8220;git add&#8221; and\/or &#8220;git commit -a&#8221;)<br \/>\n3. use &#8216;git add *&#8217;<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git add *<br \/>\n4. commit:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git commit -a -m &#8216;Update README&#8217;<br \/>\n[master c7ea471] Update README<br \/>\n2 files changed, 3 insertions(+), 1 deletion(-)<br \/>\ncreate mode 100644 README.md~<br \/>\n5. use &#8216;git push&#8217;:<br \/>\nteddy@teddy-K43SJ:\/media\/data\/MASTER\/opencv\/OpenCV-Python$ git push origin master<br \/>\nUsername for &#8216;https:\/\/github.com&#8217;: advcha<br \/>\nPassword for &#8216;https:\/\/advcha@github.com&#8217;:<br \/>\nCounting objects: 5, done.<br \/>\nDelta compression using up to 4 threads.<br \/>\nCompressing objects: 100% (3\/3), done.<br \/>\nWriting objects: 100% (3\/3), 367 bytes | 0 bytes\/s, done.<br \/>\nTotal 3 (delta 1), reused 0 (delta 0)<br \/>\nTo https:\/\/github.com\/advcha\/OpenCV-Python.git<br \/>\n1f66fba..c7ea471\u00a0 master -&gt; master<\/p>\n<p>LOCAL REPO DIRECTORY HAS DIFFERENT NAME WITH REMOTE REPO:<br \/>\nref:http:\/\/stackoverflow.com\/questions\/8570636\/change-name-of-folder-when-cloning-from-github<br \/>\ngit clone https:\/\/github.com\/sferik\/sign-in-with-twitter.git signin<br \/>\nREMOTE REPO: sign-in-with-twitter<br \/>\nLOCAL REPO: signin<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GIT TUTORIAL ref: http:\/\/rogerdudler.github.io\/git-guide\/ 1. Create a new repository create a new directory, open it and perform a git init to create a new git repository. 2. checkout a repository create a working copy of a local repository by running the command git clone \/path\/to\/repository git clone https:\/\/github.com\/balanced\/balanced-php.git when using a remote server, your command &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2017\/02\/01\/git-and-git-cola-tutorial\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Git and Git Cola Tutorial&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57],"tags":[],"class_list":["post-1660","post","type-post","status-publish","format-standard","hentry","category-github"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1660","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=1660"}],"version-history":[{"count":1,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1660\/revisions"}],"predecessor-version":[{"id":1661,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1660\/revisions\/1661"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=1660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=1660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=1660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}