git reset --hard HEAD git clean -fThose two will remove any local changes. The last one actually gets the new version.
git pull
git reset --hard HEAD git clean -fThose two will remove any local changes. The last one actually gets the new version.
git pull
git checkout -b <branch>Push the branch to github - now there's a new branch up there.
git push origin <branch>And to switch to a different branch, use
git checkout <branch>
git init | Tell git to start watching the directory
git clone <repo> | Get a local copy of the repository
.gitignore | Contains patterns of files to ignore
git rm --cached <file> | Stop tracking the file in git
git add <file> | Stage a snapshot of the file
git rm <file> | Stage the file's removal
git mv <a> <b> | Rename 'a' to 'b' and stage the change
git status | Staging status of files
git status -s | Simpler version of status
git commit | Upload to server
git commit -m "txt" | Commit, with inline message
sudo apt-get install git
git config --global user.name "YOUR NAME"set your email address to private in github. Go there:
profile --> settings --> emails --> [] keep my email address privateSet the global github private email address.
git config --global user.email "username@users.noreply.github.com"Double-check the email address.
git config --global user.email
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=1800'
mkdir ~/projects && cd ~/projects
git clone https://github.com/umhau/mpiT.git
cd mpiT
echo "Extra! Extra! Read all about it!" >> README.md
touch laughing.txt && echo "hahahaha" > laughing.txt
git add README.md
git add laughing.txt
Monitor the staging process.git status -s
Commit your staged files prior to uploading.git commit -m "write a commit message here"
Check that 'origin' is the correct short name of the github server.git remote -v
Push your commit to the github servergit push origin master
sudo apt-get install git
git config --global user.name "YOUR NAME"configure your email address - you can keep your real one private by combining your github username with a special github email domain. First, change github settings to keep the email address private. Go to:
profile --> settings --> emails --> [] keep my email address privateNow configure your email address. This tells git and github to use the private email address for all repositories downloaded to the computer.
git config --global user.email "username@users.noreply.github.com"You can confirm the email address with this command:
git config --global user.email
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=1800'
mkdir ~/projects && cd ~/projects
git clone https://github.com/umhau/mpiT.git
cd mpiT
Now you've "created a local clone" of your repository/fork. Nice! You've got the code on your computer. I'm pretty sure that everything else you do with github related to that 'local clone' has to be done while you're 'within the directory' -cd'd inside mpiT (in this case). echo "This is super important stuff!" >> README.md
git status
if you're ready to stage the file, rungit add README.md
you can also use the git add command on a directory, and it will recursively stage everything in the directory for the next commit.echo "hahahaha" > laughing.txt
you have to tell git to track it -git add laughing.txt
and it will be automatically staged (what else was git supposed to do with it?).git status -s
to get a less 'verbose' version of the status output. When everything has been edited and modified and staged properly, usegit commit -m "write a commit message here"
to upload your changes. Keep the quotation marks when you write your message, which is intended to tell others what changes you made. If you don't include the -m "commit message" bit, then you'll be prompted for a longform message in a command line text editor.git remote
You should see the name used to refer to the repository -origin
just as discussed above. And if you want to see exactly what server 'origin' refers to, you can rungit remote -v
to see a list - in my case, probably something like this:origin https://github.com/umhau/mpiT.git (fetch)
origin https://github.com/umhau/mpiT (push)
Back on track: let's upload the commit you assembled (the commit: your collection of staged files). It's called pushing, and you do it like this:git push origin master
Now the changes you made on your computer have been uploaded to github. That's it!I'm switching over to github pages . The continuation of this blog (with archives included) is at umhau.github.io . By the way, the ...