You are on page 1of 4

To control the app version, and possibilitam outros a contribuirem no proj

Após baixar e instalar o git client:

*Git config --global user.name “The Name”

-->to config globally the users name

*Git config --global user.email the@email.com

-->to config globally the users email

*Git config --list

-->to list all configs (name, email, etc)

*pwd

-->Enters the default path

*mkdir The_Name

-->Makes a folder in the path

*rm –RF The_Name

-->Removes a folder

*cd The_Name/

-->navigates the folder

Inside a folder we can be making our repositories. A repo is a folder. Initialized by:

*git init

-->Inside a repo path to initialize it as a git repository.

*touch filename.extension

-->to create a file

*localProgramName filename

-->opens a file with a local program


*git status

-->it shows which branch we’re at, the commits we’ve had so far, untracked files or added files to
commit, etc.

.
*git add or filename.ext

-->to add new files to be commited

*git commit –m “The reason you’re commiting”

-->to commit some change

*git log

-->shows your commits ids, in which branch, the author (name and email), what date too, etc

You create a new repo (with the same local repo name) in the Git server account and then, connect it to
your local repo:

*git remote add origin the_http_addres

-->connect a local git repo with a git server repo

*git remote -v

-->to check if it’s connected properly

*git push –u origin master

-->to push a commit to git server for the first

…………………………………………………………………………………………………………………………………………………………………

*ssh-keygen –t rsa –C the@email.com

-->to link to a git server with ssh. To clone git server repos to local repos.
After pasting the public ssh to git server

*ssh –T git@github.com

-->to authenticate with ssh

After creating a repo in git server, go to clone repo and paste the ssh link. Navigate to the local root
folder for repos and:

*git clone ssh_link

-->to clone into local repo

*ls -ltr

-->list files in a dir

*git push origin master

-->to push to a ssh clone git server

git log --pretty=oneline -->a parameter to make a listing look better

*git reset --soft commit3_hash

-->removes/undoes all changes made in higher commits than commit3, but the changes still remaining
there – possible to revert. More for local repos

*git revert commit_hash

-->removes/undoes all changes made in this commit. More for git server repos.

*git branch branch_name

-->to create a branch

*git branch -v

-->to visualize the existing branches


*git checkout branch_name

-->to switch the branch

Each branch has its own changes and added files

*git push –u origin branch_name

-->to push a branch to git server

*git merge branch_name

-->to merge a branch (its files, changes, etc.) to the current branch we’re in now

*git branch –D branch_name

-->to delete a branch locally, being out of it (in the main branch)

*git push origin --delete branch_name

-->to push a deleted branch to git server

You might also like