Difference between revisions of "IT-SDK-Git"

From wiki.samerhijazi.net
Jump to navigation Jump to search
(init)
(Branching)
Line 52: Line 52:
 
git branch -m feature1 feature2          # To rename a local Git branch
 
git branch -m feature1 feature2          # To rename a local Git branch
 
git push -u origin feature2:feature3    # To rename a remote Git branch
 
git push -u origin feature2:feature3    # To rename a remote Git branch
 +
</pre>
 +
 +
=Taging=
 +
<pre class="code">
 +
$ git tag -d $(git tag -l)         # Delete All local tags. (Optional Recommended)
 +
$ git fetch # Fetch remote All tags. (Optional Recommended)
 +
$ git push origin --delete $(git tag -l) # Delete All remote tags. Pushing once should be faster than multiple times
 +
$ git tag -d $(git tag -l)         # Delete All local tags.
 
</pre>
 
</pre>

Revision as of 10:30, 24 January 2020

Resource

ssh

type %userprofile%\.ssh\id_rsa.pub | clip
cat %userprofile%\.ssh\id_rsa.pub | clip

Settings

git config --global user.name "Samer Hijazi"
git config --global user.email "samer.hijazi@samerhijazi.net"
...
git config http.receivepack true
git update-server-info

Credential Storage

  • default: no cache at all
  • cache: keeps credentials in memory for a certain period of time.
  • store: saves the credentials to a plain-text file on disk.
  • Mac-Chain: in Mac caches credentials in the secure keychain "osxkeychain".
  • Windows-Chain: in Windows caches credentials in the secure keychain.
git config --global credential.helper cache
git config --global credential.helper 'store --file ~/.my-credentials'
git config --global credential.helper manager
git config --global credential.helper wincred
git config --global --edit
...
git credential-manager version

init

git init --bare         # Initial Repo for remote
git init                # Initial Repo for local
...
git remote add origin https://samerhijazi@gitlab.com/samerhijazi/public.git

Workflow

git clone ssh://ssh-w0000000@servername.com/www/htdocs/w0000000/repository/git/projectname.git
git pull
git add README.md
git commit -m "First commit"
git push -u origin master

Branching

git branch -m feature1 feature2          # To rename a local Git branch
git push -u origin feature2:feature3     # To rename a remote Git branch

Taging

$ git tag -d $(git tag -l)	         # Delete All local tags. (Optional Recommended)
$ git fetch				 # Fetch remote All tags. (Optional Recommended)
$ git push origin --delete $(git tag -l) # Delete All remote tags. Pushing once should be faster than multiple times
$ git tag -d $(git tag -l)	         # Delete All local tags.