Herramientas de usuario

Herramientas del sitio


wiki2:gitcommands

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
wiki2:gitcommands [2018/09/04 10:51]
alfred [Remove a file from the commit]
wiki2:gitcommands [2020/06/16 12:26] (actual)
Línea 85: Línea 85:
 <​code>​ <​code>​
  git reset HEAD~   git reset HEAD~ 
 +</​code>​
 +
 +==== Unstage changes ====
 +<​code>​
 +git rm --cached -r -- .
 +</​code>​
 +
 +===== Reset =====
 +==== Reset a full repo ====
 +<​code>​
 +git reset --hard HEAD
 +git clean -f -d
 +</​code>​
 +
 +==== Reset a single file ====
 +<​code>​
 +git checkout filename
 +</​code>​
 +
 +==== Reset a file with the same name as a branch ====
 +
 +<​code>​
 +git checkout -- filename
 +</​code>​
 +
 +==== Remove not tracket files ====
 +<​code>​
 +git clean -f -d 
 </​code>​ </​code>​
 ===== Branches ===== ===== Branches =====
Línea 99: Línea 127:
 </​code>​ </​code>​
  
-==== Eliminar branch ​local ====+==== Eliminar branch ==== 
 +=== Local ===
  
 <​code>​ <​code>​
 git branch -D no_queues git branch -D no_queues
 +</​code>​
 +
 +=== Remota ===
 +
 +<​code>​
 +git push origin --delete test
 </​code>​ </​code>​
  
Línea 131: Línea 166:
  
 Upload tags to the remote: ''​git push origin --tags ''​ Upload tags to the remote: ''​git push origin --tags ''​
 +
 +Remove a tag:
 +<​code>​
 +git push --delete origin <​tagname>​
 +</​code>​
 ===== Push over a non-bare repo ===== ===== Push over a non-bare repo =====
 You need to set denyCurrentBranch You need to set denyCurrentBranch
Línea 168: Línea 208:
 In case you've made a mistake while resolving a conflict and realize this only after completing the merge, you can still easily undo it: just roll back to the commit before the merge happened with ''​git reset --hard ''​ and start over again. In case you've made a mistake while resolving a conflict and realize this only after completing the merge, you can still easily undo it: just roll back to the commit before the merge happened with ''​git reset --hard ''​ and start over again.
  
 +
 +===== Bundle =====
 +
 +Create a bundle file:
 +<​code>​
 +git bundle create your_name.bundle --all
 +</​code>​
 +Use it:
 +<​code>​
 +git clone <​path_to_bundle_file>​
 +</​code>​
 ===== Fixing ===== ===== Fixing =====
 ==== A detached head ==== ==== A detached head ====
Línea 207: Línea 258:
 </​code>​ </​code>​
  
 +Other easier:
 +<​code>​
 +git remote add gitea https://​git.alfredgg.dev/​gtd/​docker-without-pants.git
 +git push gitea
 +</​code>​
 ==== Use git from another folder ==== ==== Use git from another folder ====
 <​code>​ <​code>​
Línea 216: Línea 272:
 <​code>​ <​code>​
 git config --global credential.helper 'cache --timeout 86400' git config --global credential.helper 'cache --timeout 86400'
 +</​code>​
 +
 +<​code>​
 +git config credential.helper store
 +</​code>​
 +==== Gitlab beginning ====
 +
 +Git global setup
 +<​code>​
 +git config --global user.name "​user1"​
 +git config --global user.email "​user1@test.com"​
 +</​code>​
 +Create a new repository
 +<​code>​
 +git clone http://​127.0.0.1/​user1/​test.git
 +cd test
 +touch README.md
 +git add README.md
 +git commit -m "add README"​
 +git push -u origin master
 +</​code>​
 +Existing folder
 +<​code>​
 +cd existing_folder
 +git init
 +git remote add origin http://​127.0.0.1/​user1/​test.git
 +git add .
 +git commit -m "​Initial commit"​
 +git push -u origin master
 +</​code>​
 +Existing Git repository
 +<​code>​
 +cd existing_repo
 +git remote rename origin old-origin
 +git remote add origin http://​127.0.0.1/​user1/​test.git
 +git push -u origin --all
 +git push -u origin --tags
 </​code>​ </​code>​
wiki2/gitcommands.1536058266.txt.gz · Última modificación: 2020/05/09 09:25 (editor externo)