Difference between revisions of "Git reference"

From thelinuxwiki
Jump to: navigation, search
(Pushed from Themanclub.)
 
 
(12 intermediate revisions by one user not shown)
Line 1: Line 1:
 
git - distributed revision control system  
 
git - distributed revision control system  
  
'''4 main commands'''
+
[[File:git basics.jpg]]
  
1. git pull ''project_name'' <<< update local code revision
+
create repositories by creating a directory for each project. Once you are in the directory,
  '''cd ~/src/droidpod'''
+
  get pull droidpod
+
  
2. git push ''project_name''
+
# git init
         
+
3. git add ''src_code_filename''  <<< adds src code to commit queue
+
example:   
+
  git add DroidPod.java
+
     
+
4. git commit -m ''comment-about-commit''
+
  
 +
Adding Files to the Repository
 +
git add *
 +
or
 +
git add filename.txt
  
[[category:programming]]
+
Committing Files
 +
The Git add command is normally followed immediately by the Git commit command.
 +
 
 +
committing creates a snapshot
 +
git commit -a -m "This is my commit message!"
 +
 
 +
list files to be added by a commit
 +
git status
 +
 
 +
list commit history for current branch
 +
git log
 +
 
 +
show files committed
 +
 
 +
git log --name-status
 +
 
 +
git branch
 +
 
 +
git checkout
 +
 
 +
ignore file git thinks is changed
 +
  git update-index --assume-unchanged <file|directory>
 +
 +
convenient way to modify the most recent commit log 
 +
  git commit --amend
 +
 
 +
==remote repos==
 +
 
 +
adding remote repo
 +
$ git remote add origin user@192.168.1.5:/home/user/mygitrepo
 +
 
 +
list remote repos
 +
$ '''git remote -v'''
 +
origin  user@192.168.1.5:/home/user/mygitrepo (fetch)
 +
origin  user@192.168.1.5:/home/user/mygitrepo (push)
 +
 
 +
delete remote repo
 +
$ '''git remote remove origin'''
 +
 
 +
list tracked files
 +
$ git ls-treee -r master --name-only
 +
 
 +
resetting tracked files
 +
configure .gitignore as desired
 +
rm -rf .git
 +
git add .
 +
git status
 +
git commit
 +
 
 +
== links ==
 +
 
 +
[http://sixrevisions.com/web-development/introductory-guide-to-git-version-control-system/ beginner guide]
 +
 
 +
[http://jonas.nitro.dk/git/quick-reference.html GIT cheatsheet]
 +
 
 +
[http://git-scm.com/book pro git book]
 +
 
 +
 
 +
== links ==
 +
 
 +
[http://sixrevisions.com/web-development/introductory-guide-to-git-version-control-system/ beginner guide]
 +
 
 +
[http://jonas.nitro.dk/git/quick-reference.html GIT cheatsheet]
 +
 
 +
[http://git-scm.com/book pro git book]

Latest revision as of 17:52, 26 January 2021

git - distributed revision control system

git basics.jpg

create repositories by creating a directory for each project. Once you are in the directory,

# git init

Adding Files to the Repository

git add *

or

git add filename.txt

Committing Files The Git add command is normally followed immediately by the Git commit command.

committing creates a snapshot

git commit -a -m "This is my commit message!"

list files to be added by a commit

git status

list commit history for current branch

git log

show files committed

git log --name-status
git branch 
git checkout

ignore file git thinks is changed

 git update-index --assume-unchanged <file|directory>

convenient way to modify the most recent commit log

 git commit --amend

remote repos

adding remote repo

$ git remote add origin user@192.168.1.5:/home/user/mygitrepo

list remote repos

$ git remote -v
origin  user@192.168.1.5:/home/user/mygitrepo (fetch)
origin  user@192.168.1.5:/home/user/mygitrepo (push)

delete remote repo

$ git remote remove origin

list tracked files

$ git ls-treee -r master --name-only

resetting tracked files

configure .gitignore as desired
rm -rf .git
git add .
git status
git commit

links

beginner guide

GIT cheatsheet

pro git book


links

beginner guide

GIT cheatsheet

pro git book