Below I will summarize the list of most important Git commands. Note that the names put in the hyperlink-format have to be substituted with the actual names specific to your work.
git clone url_or_path_to_repository-you-copy.git
Clones (copies everything from) another repository, located at url_or_path_to_repository-you-copy.git to your current repository
git remote add remote-name remote-url
git remote rename old-remote-name new-remote-name
To rename repository
git remote rm remore-name
To remove repository the remote remore-name from your list of available remotes. This doesn't change the remote repository, of course
takes the latest version of your remote (usually called "origin") master (by default) branch and merges it into you presently chosen branch.
git pull remote-name remote-branch
git push remote-name remote-branch
Same as "git pull" and its version, only you send your code back - from your local repositry to the remote (called upstream repository)
Creates a new, empty repository
git add files-or-directories
This will add the files-or-directories to the so-called "staging" area (think of active space in excited dynamics) - something you are working with at the moment.
git commit -m "Some-message"
This will commit the files in the "staging" area to the development history of the code - this way you save the most valuable and recent state of the project. The message should be informative and must describe clearly what changes have you made in the present version w.r.t. the older state of the code.
git branch branch-name
Will create a new branch called branch-name. The present repository in its present state will be copied into the new branch.
git checkout branch-name
Switch into the branch-name branch. You will see a corresponding set of files. The uncommited changes in the branch from which you are switching will be forgotten (i think)
git merge branch-name
Will delete the branch called branch-name into the branch where you presently are.
git branch -d branch-name
Will delete the branch called branch-name.
shows the current state of your project
shows the history of all commits
git log --graph --pretty=format:'%C(magenta)%h%C(blue)%d%Creset %s %C(blue bold)- %an, %ar%Creset'
shows the history of all commits and the development tree, highlights the sections
shows changes in the present state made w.r.t. the latest commit
shows the list of available branches
git remote -v
shows the list of available remote repositories
Below, I will show some typical sessions with git, I had so far. I may be using specific names for the repositories - but you'll have to adapt them to your specifics, of course
work on the file "main.cpp"
git add main.cpp
work on several files in the "src" directory of my project
git add src/
git commit -m "Added new features in the main program and some documentation in other source files"