Local - everything is local - unless you push pull or clone
Default branch - default name -"master"
Remote repository - default name "origin"
When you clone it is in your local computer, get all of commits that most up to date stuff.
If a change was made to a file(ex - a.py, b.py, c.py:
git will know if you make a modification to a.py - put in staging area(says when adding, that all the files in stage will be added when you add them)
then git commit -m "change" - staging area is cleared and then it is on local commit history
if someone else was changing the files in the repository and pushed it on the repository, when you go to push your from local to remote (so before you push you have to update(git pull) the remote and then push(git pull) it)
now someone else clones it and changes a.py and pushes it
then you make a different change to a.py and you commit to your repository - now if you want everyone else to see it you have to push it to origin - error messages - merge conflict
merge conflict - cant merge without corrupting code so human should tell me what to do, sometimes they are hard to debug
then you overwrite with the version you want and shows new version then you push to local and updates remote also
Branches
instead of committing changes to the master branch you create tour own branch in that repository
git checkout -to "database" <-- command to create a branch
now if you add files it will commit to a different branch
doesn't overwrite master instead puts it to the side
ex - git push origin database instead of git push origin master
git checkout master - all files vanish from your directory
git checkout "" - change between branches
git checkout database - resume work on database
head - state of directory reflected
if you want to merge 2 branches (database and master)
git merge database when your head is in master - merges branch into master
now master has its history up to date with both of the branches
git merge master when head is in database - merges master into branch - good if u want to change or test stuff
deleting branch does not delete commit history, if you want to delete a file you have to delete the commit = nasty :( don't do it
Local - everything is local - unless you push pull or clone
Default branch - default name -"master"
Remote repository - default name "origin"
git will know if you make a modification to a.py - put in staging area(says when adding, that all the files in stage will be added when you add them)
then git commit -m "change" - staging area is cleared and then it is on local commit history
if someone else was changing the files in the repository and pushed it on the repository, when you go to push your from local to remote (so before you push you have to update(git pull) the remote and then push(git pull) it)
merge conflict - cant merge without corrupting code so human should tell me what to do, sometimes they are hard to debug
then you overwrite with the version you want and shows new version then you push to local and updates remote also
Branches instead of committing changes to the master branch you create tour own branch in that repository git checkout -to "database" <-- command to create a branch now if you add files it will commit to a different branch doesn't overwrite master instead puts it to the side ex - git push origin database instead of git push origin master git checkout master - all files vanish from your directory git checkout "" - change between branches git checkout database - resume work on database head - state of directory reflected
if you want to merge 2 branches (database and master) git merge database when your head is in master - merges branch into master now master has its history up to date with both of the branches git merge master when head is in database - merges master into branch - good if u want to change or test stuff
deleting branch does not delete commit history, if you want to delete a file you have to delete the commit = nasty :( don't do it