Skip to main content

3 posts tagged with "command"

View All Tags

· One min read
Lejen

Step 1: Pull upstream changes

git pull --rebase upstream master

The --rebase option places your changes on top of the latest commit without merges.

Step 2: (Optional) Merge your commits into 1 commit

git reset --soft upstream/master

This command will "undo" all your commits, but won't change the files. So you can commit all your changes in a single commit.

git commit -a

Step 3: Check & test your changes

To show the changes use a GUI like the built-in gitk, Sourcetree, TortoiseGit or Tower (paid), etc.

Step 4: Push

git push will throw an error, push with "-f"

git push -f origin master

Additional information

The command to add a remote is:

git remote add upstream git://github.com/[username]/[project].git You can also also pull from a direct URL:

git pull --rebase git://github.com/[username]/[project].git But then you'll need the hash of the latest upstream commit instead of "upstream/master" in the other steps.

· One min read
Lejen

Since the task was to simply use another branch instead of master, you can simply remove master branch completely or rename it to let's say - legacy, then take another branch and rename it to master. That's it. Here are actual commands that you might need to execute to achieve the goal locally and on GitHub:

git branch -m master legacy               # rename local master to legacy
git checkout legacy
git branch -m another_branch master # another_branch will be our new master

Locally we are done now. However you cannot simply remove master branch on GitHub. You need to take another branch as default first. This can be done in repository Settings > Default Branch. Once you do this, you can proceed:

git push origin :master                   # remove master on GitHub
git push origin master # push out our new master branch
git push origin legacy # push our legacy branch too

Then go back to Settings > Default Branch and switch default branch back to master. Additionally you can remove all extra branches that you might have created during migration process.

Alternatively, if you are looking to save all your actions in history, check a correct answer here.

· One min read
Lejen

hugo server --noHTTPCache --disableFastRender hugo server --noHTTPCache --disableFastRender --ignoreCache

Create Post

hugo new post/create-virtual-environment-in-linux/index.md

Install Hugo

curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest \
| grep browser_download_url \
| grep Linux-64bit.deb \
| grep -v extended \
| cut -d '"' -f 4 \
| wget -i -

curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest \
| grep browser_download_url \
| grep extended_0.81.0_Linux-64bit.deb \
| cut -d '"' -f 4 \
| wget -i -