User Tools

Site Tools


git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
git [2013/07/01 19:49]
k2patel [Backup]
git [2016/06/08 15:27]
k2patel [Script for Backup]
Line 2: Line 2:
  
 ==== Setting up GIT ==== ==== Setting up GIT ====
 +=== Create Server ===
 +== Define User ==
 +<code bash>
 +git config --global user.name "​k2patel"​
 +git config --global user.email "​k2patel@live.com"​
 +</​code>​
 +
 +== Create location for Repository ==
 +<note tip>​replace location with your desired location</​note>​
 +<code bash>
 +mkdir -p /​data/​git/​bumper.git
 +cd /​data/​git/​bumper.git
 +</​code>​
 +
 +== Create bare repository ==
 +<code bash>
 +git --bare init
 +</​code>​
 +
 +=== Initial Synchronize with client ===
 +== Initializing commit ==
 +<note tip>​replace project location with desired location</​note>​
 +<code bash>
 +cd /​data/​project/​bumper/​
 +git init
 +git add .
 +git commit -m "​Initial Commit"​
 +</​code>​
 +
 +== Define server and push files ==
 +**For Local**
 +<code bash>
 +git remote add origin /​data/​git/​bumper.git
 +git push origin master
 +</​code>​
 +
 +**For Remote**
 +<code bash>
 +git remote add origin ketan@reposerver:/​data/​git/​bumper.git
 +git push origin master
 +</​code>​
  
 ==== Backup ==== ==== Backup ====
Line 69: Line 110:
 done done
 </​code>​ </​code>​
 +
 +==== Git reset local ====
 +**following command can be used for following purpose :** \\
 +To discard all local changes and restore it to the remote repository.\\
 +When you have error //Your branch is ahead of '​origin/​master'//​
 +<code bash>
 +git reset --hard origin/​master
 +git pull
 +</​code>​
 +
git.txt ยท Last modified: 2020/08/10 02:35 (external edit)