Git Commands
Git Commands
Git Commands
*Initialize git
git init
*Remove branch
*Add files
git add . # Run it
after adding the files to the local directory
git commit -m "First commit" # Commits the tracked
changes and prepares them to be pushed to a remote repository
git remote add origin remote <repository URL> # Sets the new remote
git remote -v # Verifies
the new remote URL
git push origin master # Pushes the
changes in your local repository up to the remote repository you specified as the
origin
NOTE: if we want to push to specific branch, change branch with "git checkout
mybranch"
*Undo add
git reset
*Create branch
git checkout -b [name_of_your_new_branch] #Create the branch on your local
machine and switch in this branch
git push origin [name_of_your_new_branch] #Push the branch on github
*To view both remote-tracking branches and local branches, run the command:
git branch -a
*push force
git push --force
*stop merging
git merge --abort
*Reemplace all files in branch with the files from branch remote/branch
git reset --hard remote/branch
When we use the push function, we are handing…the task of migrating the
database to the origin site.…The origin site literally pushes the database…to the
target site.…This is what you would use any time you are moving…a database from a
local host environment…to a live environment on the web,…meaning any time the
database sits on a server…that may not be accessible from the target site.…
You can also use the push function from one live site…on the web to another.…
The only think you can't do is push a database…from a live site on the web to a
site that's…hosted either locally on a computer,…or locally within a network the
web does not…have access to.…With pull, the target site does all the work.…In this
case, the target goes to the origin site…
***************
Computational Methods Class
git clone "link" => linkea el github
git status => te dice lo que hay
IGNORAR ARCHIVOS
Hacer fichero:
vi .gitignore
Escribir dentro el nombre de las carpetas que no queires clonar "ej: carpetafea/"
SUBIR CAMBIOS
git commit
git push