Tuesday, October 22, 2013

Git + GitHub Commands

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin [url
git push -u origin master

git clean -fd   # removes all unstaged files, recursivel
git reset --hard [HEAD hash] # To reset the files to a commit point:
git clone [url]


git status                                  #see what files have been modified
git add files.txt                            #add the file.txt to the next commit
git log # use ctrl+z to finish

git add -u                                # to stage deleted files from the whole tree [more info: http://stackoverflow.com/questions/1402776/how-do-i-commit-all-deleted-files-in-git


Other resets:
http://stackoverflow.com/questions/4114095/revert-to-previous-git-commit


git push
git pull
git reflog

git rm --chached file.txt                        #basic, the opposite of git add
file ".gitignore"                            #list in there all the files to be ignored

No comments:

Post a Comment