WELCOME Abdennour : Software engineer

May 9, 2012

Git Command Line

We do summary from this link  . thank you Vogella .
@see : http://www.vogella.com/articles/Git/article.html

sudo apt-get install git-core
sudo apt-get install gitk  #for Graphical User Interface

2.Configure the user which will be used by git :

$ git config --global user.name "Abdennour"

3.Same for Email Address :

$ git config --global user.email "abdennour.toumi@gmail.com"

4.Set default so that all changes are always pushed to the repository:

git config --global push.default"matching"

5.To query your Git settings
git config --list
6.enable some highlighting(Colors) for the console: 
git config --global color.status auto
git config --global color.branch auto  

 Create content

git config --list
6.enable some highlighting(Colors) for the console:
git config --list
6.enable some highlighting(Colors) for the console:
git config --list
6.enable some highlighting(Colors) for the console:
git config --list
6.enable some highlighting(Colors) for the console:
git config --list
6.enable some highlighting(Colors) for the console:
git config --list
6.enable some highlighting(Colors) for the console


625 git config --global user.name "Abdennour"
  626  git config --global user.email "abdennour.toumi@gmail.com"
  627  git config --list
  628  git config --global push.default"matching"
  629  git config --list
  630  git remote
  631  cd ~
  632  mkdir repo02
  633  cd ./repo02/
  634  git clone ../remote-repository.git
  635  cd ~
  636  mkdir repo01
  637  cd ./repo01/
  638  mkdir datafiles
  639  touch test01
  640  touch test02
  641  touch test023
  642  rm test023
  643  ls
  644  touch test03
  645  touch datafiles/data.txt
  646  ls >test01
  647  cat test01
  648  git init
  649  git add .
  650  git commit -m "Initial commit"
  651  git log
  652  echo "This is a change of Test1">test01
  653  echo "This is another change of Test">test02
  654  git diff
  655  echo "This is a new change of Test1">test01
  656  echo "This is another new change of Test">test02
  657  git status
  658  git diff
  659  git add . && git commit -m "More Changes and Commit"
  660  git log
  661  gitk --all
  662  su
  663  gitk --all
  664  git commit --amend -m "More changes - now correct"
  665  touch nonsense.txt
  666  git add . && git commit -m "a new file has been created"
  667  rm nonsense.txt 
  668  git add . && git commit -m "a new file has been created"
  669  git commit -a -m "a file nonsense is removed"
  670  echo "Work With REMOTE GIT"
  671  git clone --bare . ../remote-repository.git
  672  echo "Check the content, it is identical to the .git directory in repo01"
  673  ls ~/remote-repository.git/
  674  echo "Push changes to another repository"
  675  echo "# Make some changes in the file"
  676  echo "Selem Selem.Turn your iPad on">test01
  677  echo "Selem Selem.Turn your iPad off">test02
  678  echo "Commit the changes, -a will commit changes for modified files# but will not add automatically new files"
  679  git commit -a -m "Some Changes"
  680  echo "PUSH CHANGES"
  681  git push ../remote-repository.git
  682  git remote add origin ../remote-repository.git
  683  echo "I added a remote Repo" >test02
  684  git commit -a -m "This is a test for the new remote origin"
  685  git push origin
  686  echo "Show the existing defined remote repositories"
  687  git remote
  689  echo "Switch to new directory ~/repo02"
  690  cd ~/repo02/
  691  git clone ../remote-repository.git
  692  ls
  693  ls -R
  694  echo "Pull changes:Pull allows you to get the latest changes from another repository."
  695  echo "In your second repository, make some changes, push them to your remote repository and pull these changes to your first repository."
  696  cd ~
  697  cd ~/repo02
  698  echo "a change">test01
  699  git commit -a -m "a change"
  700  cd ..
  701  rm -r ./repo02
  702  mkdir repo02/
  703  cd ~/repo02
  704  git clone ../remote-repository.git .
  705  ls
  706  echo "a change">test01
  707  git commit -a -m "a change"
  708  echo "Push changes to remote repository"
  709  echo "Origin is automatically maintained as we cloned from this repository"
  710  git push origin
  711  echo "Switch to the first repository and pull in the changes"
  712  cd ~/repo01
  713  git pull ../remote-repository.git/
  714  echo "CHECK THE CHANGES"
  715  less test01
  716  echo "*************6***********"
  717  echo "REVERT CHANGES"
  718  echo "to trash">test04
  719  echo " -n is the same as --dry-run "
  720  git clean -n
  721  echo "NOw delete"
  722  git clean -f
  723  git log
  724  git log|more
  725  git checkout commit_name
  726  git checkout "a change"
  727  git checkout test01
  728  echo "nonsense change"> test01
  729  git checkout test01
  730  cat test01
  731  echo "another nonsense change"> test01
  732  git add test01
  733  git reset HEAD test01
  734  git checkout test01
  735  cat test01
  736  git revert test01
  737  git revert "a change"
  738  rm test01
  739  ls
  740  git checkout test01
  741  ls
  742  echo "**If you added a file to the index but do not want to commit the file, you can remove it from the index via the git reset file command.**"
  743  touch incorrect.txt
  744  git add .
  745  git reset incorrect.txt 
  746  rm incorrect.txt 
  747  git checkout incorrect.txt
  748  echo "**If you deleted a directory and you have not yet committed the changes, you can restore the directory via the following command:****"
  749  echo "$>git checkout HEAD -- your_dir_to_restore"
  750  git tag
  751  echo "***************TAGS*********"
  752  echo "Via the -m parameter, you specify the description of this tag."
  753  git tag version1.6 -m 'it is the version 1.6'
  754  git checkout version1.6
  755  echo "**8******BRANCHING&MERGING"
  756  git branch
  757  echo "branches, e.g. independent copies of the source code which can be changed independently from each other."
  758  echo " The default branch is called master"
  759  git branch
  760  echo "The currently active branch is marked with *."
  761  echo "see all branches (including remote branches)"
  762  git branch -a
  763  echo "*****create a new branch *****"
  764  echo "Syntax: git branch <name> <hash>"
  765  echo "<hash> in the above is optional "
  766  git branch testing
  767  echo "Switch to your new branch testinf"
  768  echo "Switch to your new branch testing"
  769  git checkout testing
  770  git branch -a
  771  echo "cool new feature in this branch">test01
  772  git commit -a -m "new feature"
  773  echo "Switch to the master branch"
  775  git branch -a
  776  echo " Check that the content of test01 is the old one"
  777  cat test01
  778  echo "****8.2.MERGING****"
  779  echo "==>Merge allows you to combine the changes of two branches."
  780  echo "Merge performs a so-called three-way-merge between the latest snapshot of two branches, based on the most recent common ancestor of both"
  781  echo "# Syntax: git merge <branch-name>"
  782  git merge testing
  783  echo "****8.3.Delete a branch******"
  784  git branch -d testing
  785  git branch
  786  git branch -a
  787  echo "***8.4. Push a branch to remote repository****"
  788  echo "# Push testing branch to remote repository"
  789  git push origin testing
  790  git branch testing
  791  git push origin testing
  792  echo "# Switch to the testing branch"
  793  git checkout testing
  794  echo "News for abdennour and you" > test01
  795  git commit -a -m "new feature in branch"
  796  echo "push all inclufing branch"
  797  git push
  798  mkdir /root/Dropbox/Public/3.TUTO/GIT
  799  touch /root/Dropbox/Public/3.TUTO/GIT/command_lineFromVogella.log
  800  history >/root/Dropbox/Public/3.TUTO/GIT/command_lineFromVogella.log

No comments:

Post a Comment